Annotation of previous/CMakeLists.txt, revision 1.1.1.5

1.1       root        1: 
                      2: cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
                      3: 
                      4: project(Previous)
                      5: 
                      6: SET(APP_NAME "Previous")
                      7: 
                      8: set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
                      9: 
                     10: include(CheckIncludeFiles)
                     11: include(CheckFunctionExists)
1.1.1.2   root       12: include(CheckCCompilerFlag)
1.1       root       13: include(DistClean)
                     14: 
                     15: # Set build type to "Release" if user did not specify any build type yet
                     16: # Other possible values: Debug, Release, RelWithDebInfo and MinSizeRel
                     17: if(NOT CMAKE_BUILD_TYPE)
                     18:        set(CMAKE_BUILD_TYPE Release)
                     19: endif(NOT CMAKE_BUILD_TYPE)
                     20: 
                     21: # set(CMAKE_VERBOSE_MAKEFILE 1)
                     22: 
                     23: # ##########################
                     24: # Conditional build features
                     25: # ##########################
                     26: 
                     27: set(ENABLE_TRACING 1
                     28:     CACHE BOOL "Enable tracing messages for debugging")
                     29: 
                     30: if(APPLE)
                     31:        set(ENABLE_OSX_BUNDLE 1
1.1.1.2   root       32:            CACHE BOOL "Built Previous as Mac OS X application bundle")
1.1       root       33:        # set(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Target architectures" FORCE)
                     34:        # set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" CACHE STRING "10.6 SDK" FORCE)
                     35:        # set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "Target Min 10.5" FORCE)
                     36:        set(ADDITIONAL_INCLUDES ${FRAMEWORKS})
                     37:        set_source_files_properties(${FRAMEWORKS} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
                     38: else()
                     39:        set(ENABLE_OSX_BUNDLE 0
                     40:            CACHE BOOL "Built Hatari as Mac OS X application bundle")
                     41: endif(APPLE)
                     42: 
                     43: # ####################
                     44: # Check for libraries:
                     45: # ####################
                     46: 
1.1.1.3   root       47: find_package(SDL2 REQUIRED)
                     48: if(NOT SDL2_FOUND)
                     49:        message(FATAL_ERROR "SDL2 library not found!")
                     50: endif(NOT SDL2_FOUND)
1.1       root       51: 
                     52: find_package(Math)
                     53: 
                     54: find_package(Readline)
                     55: if(READLINE_FOUND)
                     56:        set(CMAKE_REQUIRED_LIBRARIES "readline")
                     57:        check_function_exists(rl_filename_completion_function HAVE_RL_COMPLETION_FUNCTION)
                     58:        if(HAVE_RL_COMPLETION_FUNCTION)
                     59:                set(HAVE_LIBREADLINE 1)
                     60:        else()
                     61:                unset(READLINE_FOUND)
                     62:        endif(HAVE_RL_COMPLETION_FUNCTION)
                     63:        set(CMAKE_REQUIRED_LIBRARIES "")
                     64: endif(READLINE_FOUND)
                     65: 
                     66: find_package(ZLIB)
                     67: if(ZLIB_FOUND)
                     68:        set(HAVE_LIBZ 1)
                     69: endif(ZLIB_FOUND)
                     70: 
                     71: find_package(PNG)
                     72: if(PNG_FOUND)
                     73:        set(HAVE_LIBPNG 1)
                     74: endif(PNG_FOUND)
                     75: 
1.1.1.5 ! root       76: find_package(PCAP)
        !            77: if(PCAP_FOUND)
        !            78:        set(HAVE_PCAP 1)
        !            79: endif(PCAP_FOUND)
1.1       root       80: 
                     81: # ################
                     82: # CPP Definitions:
                     83: # ################
                     84: 
                     85: add_definitions(-DCONFDIR=\"/etc\")
                     86: 
                     87: # Test for large file support:
                     88: execute_process(COMMAND getconf LFS_CFLAGS
                     89:                 OUTPUT_VARIABLE DETECTED_LFS_CFLAGS
                     90:                 ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
                     91: if(DETECTED_LFS_CFLAGS)
                     92:        add_definitions(${DETECTED_LFS_CFLAGS})
                     93:        # message(STATUS "Large filesystem flags: ${DETECTED_LFS_CFLAGS}")
                     94: endif(DETECTED_LFS_CFLAGS)
                     95: 
                     96: # Additional CFLAGS suggested by the SDL library:
1.1.1.3   root       97: execute_process(COMMAND pkg-config --cflags-only-other sdl2
                     98:                OUTPUT_VARIABLE DETECTED_SDL_CFLAGS
                     99:                ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
1.1       root      100: 
                    101: # ###########################
                    102: # Check for optional headers:
                    103: # ###########################
                    104: 
                    105: check_include_files(strings.h HAVE_STRINGS_H)
                    106: 
                    107: # #############################
                    108: # Check for optional functions:
                    109: # #############################
                    110: 
                    111: check_function_exists(setenv HAVE_SETENV)
                    112: check_function_exists(select HAVE_SELECT)
1.1.1.2   root      113: check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
                    114: check_function_exists(nanosleep HAVE_NANOSLEEP)
                    115: check_function_exists(alphasort HAVE_ALPHASORT)
                    116: check_function_exists(scandir HAVE_SCANDIR)
1.1.1.4   root      117: check_function_exists(strdup HAVE_STRDUP)
1.1.1.2   root      118: 
                    119: 
1.1       root      120: # #############
                    121: # Other CFLAGS:
                    122: # #############
                    123: 
                    124: # Warning flags:
                    125: if(CMAKE_COMPILER_IS_GNUCC)
1.1.1.4   root      126:        set(CMAKE_C_FLAGS "-Wcast-qual -g -O0 -Wbad-function-cast -Wpointer-arith ${CMAKE_C_FLAGS} -D__USE_MINGW_ANSI_STDIO=1")
1.1       root      127:        set(CMAKE_C_FLAGS "-Wmissing-prototypes -Wstrict-prototypes ${CMAKE_C_FLAGS}")
                    128:        set(CMAKE_C_FLAGS "-Wall -Wwrite-strings -Wsign-compare ${CMAKE_C_FLAGS}")
1.1.1.2   root      129:        #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra -Wno-unused-parameter -Wno-empty-body")
1.1.1.3   root      130:        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-security -std=gnu99")
1.1.1.2   root      131:        #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow -D_FORTIFY_SOURCE=2 -Werror")
1.1       root      132: endif(CMAKE_COMPILER_IS_GNUCC)
                    133: 
1.1.1.2   root      134: # Building Previous w/o optimization is no fun...
1.1       root      135: IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
                    136:        set(CMAKE_C_FLAGS "-O ${CMAKE_C_FLAGS}")
                    137: ENDIF (CMAKE_BUILD_TYPE STREQUAL "Debug")
                    138: 
                    139: # ####################
                    140: # Paths configuration:
                    141: # ####################
                    142: 
                    143: if(NOT BINDIR)
                    144:        set(BINDIR bin)
                    145: endif()
                    146: 
                    147: if(NOT DATADIR)
                    148:        set(DATADIR share/previous)
                    149: endif()
                    150: 
                    151: if(NOT BIN2DATADIR)
                    152:        if(WIN32)
                    153:                set(BIN2DATADIR "."
                    154:                    CACHE STRING "Relative path from bindir to datadir")
                    155:        elseif(ENABLE_OSX_BUNDLE)
                    156:                set(BIN2DATADIR "../Resources"
                    157:                    CACHE STRING "Relative path from bindir to datadir")
                    158:        else()
                    159:                set(BIN2DATADIR "../share/hatari"
                    160:                    CACHE STRING "Relative path from bindir to datadir")
                    161:        endif(WIN32)
                    162:        mark_as_advanced(BIN2DATADIR)
                    163: endif()
                    164: 
                    165: if(NOT MANDIR)
                    166:        set(MANDIR share/man/man1)
                    167: endif()
                    168: 
                    169: if(NOT DOCDIR)
                    170:        set(DOCDIR share/doc/previous)
                    171: endif()
                    172: 
                    173: # #########################################
                    174: # Create config.h and recurse into subdirs:
                    175: # #########################################
                    176: 
                    177: configure_file(${CMAKE_SOURCE_DIR}/cmake/config-cmake.h
                    178:                ${CMAKE_BINARY_DIR}/config.h)
                    179: 
                    180: add_subdirectory(src)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.