diff options
author | flaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-07-12 06:39:46 +0000 |
---|---|---|
committer | flaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-07-12 06:39:46 +0000 |
commit | 9349df4e5fa122fd74d632d4227f8c1a1f32c36d (patch) | |
tree | b9789c4d58ffb21ae92ff4325fd32fa4bde38ae9 | |
parent | 3f04b3aa7a2ff0c7266f53ead689d9ea81ce5ef7 (diff) | |
download | hercules-9349df4e5fa122fd74d632d4227f8c1a1f32c36d.tar.gz hercules-9349df4e5fa122fd74d632d4227f8c1a1f32c36d.tar.bz2 hercules-9349df4e5fa122fd74d632d4227f8c1a1f32c36d.tar.xz hercules-9349df4e5fa122fd74d632d4227f8c1a1f32c36d.zip |
* CMake: set project language to C, added module FindFunctionLibrary, added search for dl library. (tested with debian-wheezy-i386)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14902 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | 3rdparty/CMakeLists.txt | 2 | ||||
-rw-r--r-- | 3rdparty/cmake/FindFunctionLibrary.cmake | 47 | ||||
-rw-r--r-- | 3rdparty/msinttypes/CMakeLists.txt | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 79 | ||||
-rw-r--r-- | Changelog-Trunk.txt | 2 | ||||
-rw-r--r-- | src/char/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/char_sql/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/common/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/login/sql/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/login/txt/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/map/sql/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/map/txt/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/tool/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/txt-converter/char/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/txt-converter/login/CMakeLists.txt | 4 |
15 files changed, 128 insertions, 63 deletions
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index a63321033..ebbac481a 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -47,7 +47,7 @@ macro( CONFIGURE_WITH_LOCAL_OR_SYSTEM name ) endmacro( CONFIGURE_WITH_LOCAL_OR_SYSTEM ) -set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH} ) +set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake CACHE INTERNAL "" ) add_subdirectory( msinttypes ) add_subdirectory( mt19937ar ) add_subdirectory( mysql ) diff --git a/3rdparty/cmake/FindFunctionLibrary.cmake b/3rdparty/cmake/FindFunctionLibrary.cmake new file mode 100644 index 000000000..f1d32001e --- /dev/null +++ b/3rdparty/cmake/FindFunctionLibrary.cmake @@ -0,0 +1,47 @@ +# - Check which library is needed to link a C function +# find_function_library( <function> <variable> [<library> ...] ) +# +# Check which library provides the <function>. +# Sets <variable> to 0 if found in the global libraries. +# Sets <variable> to the library path if found in the provided libraries. +# Raises a FATAL_ERROR if not found. +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link +include( CheckFunctionExists ) + +macro( find_function_library FUNC VAR ) + if( "${VAR}" MATCHES "^${VAR}$" ) + CHECK_FUNCTION_EXISTS( ${FUNC} ${VAR} ) + if( ${VAR} ) + message( STATUS "Found ${FUNC} in global libraries" ) + set( ${VAR} 0 CACHE INTERNAL "Found ${FUNC} in global libraries" )# global + else() + foreach( LIB IN ITEMS ${ARGN} ) + message( STATUS "Looking for ${FUNC} in ${LIB}" ) + find_library( ${LIB}_LIBRARY ${LIB} ) + mark_as_advanced( ${LIB}_LIBRARY ) + if( ${LIB}_LIBRARY ) + unset( ${VAR} CACHE ) + set( CMAKE_REQUIRED_LIBRARIES ${${LIB}_LIBRARY} ) + CHECK_FUNCTION_EXISTS( ${FUNC} ${VAR} ) + set( CMAKE_REQUIRED_LIBRARIES ) + if( ${VAR} ) + message( STATUS "Found ${FUNC} in ${LIB}: ${${LIB}_LIBRARY}" ) + set( ${VAR} ${${LIB}_LIBRARY} CACHE INTERNAL "Found ${FUNC} in ${LIB}" )# lib + break() + endif() + endif() + endforeach() + if( NOT ${VAR} ) + message( FATAL_ERROR "Function ${FUNC} not found" ) + endif() + endif() + endif() +endmacro( find_function_library ) + diff --git a/3rdparty/msinttypes/CMakeLists.txt b/3rdparty/msinttypes/CMakeLists.txt index f17c6f596..f7a662fe8 100644 --- a/3rdparty/msinttypes/CMakeLists.txt +++ b/3rdparty/msinttypes/CMakeLists.txt @@ -4,5 +4,6 @@ find_path( MSINTTYPES_INCLUDE_DIRS "inttypes.h" PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include" NO_DEFAULT_PATH ) mark_as_advanced( MSINTTYPES_INCLUDE_DIRS ) -set( GLOBAL_INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MSINTTYPES_INCLUDE_DIRS} CACHE INTERNAL "" ) +message( STATUS "Adding global include directory: ${MSINTTYPES_INCLUDE_DIRS}" ) +set_property( CACHE GLOBAL_INCLUDE_DIRS PROPERTY VALUE ${GLOBAL_INCLUDE_DIRS} ${MSINTTYPES_INCLUDE_DIRS} ) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index fb94c7c72..1b6d3ebc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,14 +14,6 @@ # ENABLE_* : option to use an internal feature/code or not # HAVE_* : internal variable indicating if we have and are using something # -# Example (build in subdir 'build' and install to source dir): -# mkdir build -# cd build -# cmake -G"Unix Makefiles" -DINSTALL_TO_SOURCE:bool=ON .. -# make install -# cd .. -# rm -rf build -# ##################################################################### @@ -33,7 +25,7 @@ # CMP0017: Prefer files from the CMake module directory when including from there. set( CMAKE_LEGACY_CYGWIN_WIN32 0 ) cmake_minimum_required( VERSION 2.8.3 ) -project( eAthena ) +project( eAthena C ) if( CYGWIN ) unset( WIN32 ) endif() @@ -45,23 +37,30 @@ endif() if( ALLOW_SAME_DIRECTORY ) elseif( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}" ) option( ALLOW_SAME_DIRECTORY "Allow CMake to build in the source directory." OFF ) - message( FATAL_ERROR "Do not use the source directory to build your files, instead create a separate folder and build there.\nExample:\n mkdir build\n cd build\n cmake -G\"Unix Makefiles\" ..\n make install\nTo skip this check, set ALLOW_SAME_DIRECTORY to 1 or ON" ) + message( FATAL_ERROR + "Do not use the source directory to build your files, instead delete CMakeCache.txt, create a separate folder and build there.\n" + "Example: (build in subdir 'build' and install to source dir)\n" + " mkdir build && cd build\n" + " cmake -G\"Unix Makefiles\" -DINSTALL_TO_SOURCE:bool=ON ..\n" + " make install\n" + " cd .. && rm -rf build\n" + "To skip this check, set ALLOW_SAME_DIRECTORY to ON (-DALLOW_SAME_DIRECTORY:bool=ON)" ) endif() # # Global stuff # -set( GLOBAL_LIBRARIES CACHE INTERNAL "" ) -set( GLOBAL_INCLUDE_DIRS CACHE INTERNAL "" ) -set( GLOBAL_DEFINITIONS CACHE INTERNAL "" ) +set( GLOBAL_LIBRARIES ${LINK_LIBRARIES} CACHE INTERNAL "" )# list (comma separated values) +set( GLOBAL_INCLUDE_DIRS ${INCLUDE_DIRECTORIES} CACHE INTERNAL "" )# list (comma separated values) +set( GLOBAL_DEFINITIONS ${COMPILE_DEFINITIONS} CACHE INTERNAL "" )# string (space separated values -DFOO=bar) mark_as_advanced( GLOBAL_LIBRARIES GLOBAL_INCLUDE_DIRS GLOBAL_DEFINITIONS ) if( WIN32 ) - list( APPEND GLOBAL_DEFINITIONS FD_SETSIZE=4096 ) - list( APPEND GLOBAL_LIBRARIES "oldnames.lib" "ws2_32.lib" ) + set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DFD_SETSIZE=4096" ) + set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} "oldnames.lib" "ws2_32.lib" ) endif() if( MSVC ) - list( APPEND GLOBAL_DEFINITIONS _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE DB_MANUAL_CAST_TO_UNION ) + set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DDB_MANUAL_CAST_TO_UNION" ) endif() @@ -84,20 +83,6 @@ message( STATUS "Detecting Subversion" ) find_package( Subversion ) message( STATUS "Detecting Subversion - done" ) - -# -# Find math library (FreeBSD) -# -message( STATUS "Detecting math library" ) -find_library( M_LIBRARIES m ) -mark_as_advanced( M_LIBRARIES ) -if( M_LIBRARIES ) - message( STATUS "Found m: ${M_LIBRARIES}" ) - list( APPEND GLOBAL_LIBRARIES ${M_LIBRARIES} ) -endif() -message( STATUS "Detecting math library - done" ) - - # # PACKETVER # @@ -126,11 +111,41 @@ endif() # -# 3rdparty +# 3rdparty and library tests # add_subdirectory( 3rdparty ) +include( FindFunctionLibrary ) +# +# math library (FreeBSD/Linux) +# +message( STATUS "Detecting m library (math)" ) +set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} ) +find_function_library( floor FUNCTION_FLOOR_LIBRARIES m ) +mark_as_advanced( FUNCTION_FLOOR_LIBRARIES ) +if( FUNCTION_FLOOR_LIBRARIES ) + message( STATUS "Adding global library: ${FUNCTION_FLOOR_LIBRARIES}" ) + list( APPEND GLOBAL_LIBRARIES ${FUNCTION_FLOOR_LIBRARIES} ) +endif() +message( STATUS "Detecting m library (math) - done" ) + + +# +# dynamic loading library (Linux) +# +if( NOT WIN32 ) +message( STATUS "Detecting dl library (dynamic loading)" ) +set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} ) +find_function_library( dlopen FUNCTION_DLOPEN_LIBRARIES dl ) +mark_as_advanced( FUNCTION_DLOPEN_LIBRARIES ) +if( FUNCTION_DLOPEN_LIBRARIES ) + message( STATUS "Adding global library: ${FUNCTION_DLOPEN_LIBRARIES}" ) + list( APPEND GLOBAL_LIBRARIES ${FUNCTION_DLOPEN_LIBRARIES} ) +endif() +message( STATUS "Detecting dl library (dynamic loading) - done" ) +endif() + ##################################################################### # package stuff @@ -302,7 +317,7 @@ add_subdirectory( src ) if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) message( WARNING "64bit should work, but is not recommended." ) elseif( NOT CMAKE_SIZEOF_VOID_P EQUAL 4 ) - message( FATAL_ERROR "unexpected architecture (CMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P})" ) + message( FATAL_ERROR "unexpected architecture (CMAKE_SIZEOF_VOID_P is ${CMAKE_SIZEOF_VOID_P})" ) endif() list( LENGTH TARGET_LIST _LEN ) if( _LEN EQUAL 0 ) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 85adf16ea..24de77fcb 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,5 +1,7 @@ Date Added +2011/07/12 + * CMake: set project language to C, added module FindFunctionLibrary, added search for dl library. (tested with debian-wheezy-i386) [FlavioJS] 2011/07/11 * Rev. 14901 Added bonus3 bAddClassDropItem, care of Epoque. [L0ne_W0lf] 2011/07/10 diff --git a/src/char/CMakeLists.txt b/src/char/CMakeLists.txt index 559718c26..29bfeb6fe 100644 --- a/src/char/CMakeLists.txt +++ b/src/char/CMakeLists.txt @@ -33,7 +33,7 @@ set( TXT_CHAR_SOURCES set( DEPENDENCIES common_base ) set( LIBRARIES ${GLOBAL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) -set( DEFINITIONS ${GLOBAL_DEFINITIONS} TXT_ONLY ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} -DTXT_ONLY" ) set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${TXT_CHAR_HEADERS} ${TXT_CHAR_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ) source_group( char FILES ${TXT_CHAR_HEADERS} ${TXT_CHAR_SOURCES} ) @@ -41,7 +41,7 @@ include_directories( ${INCLUDE_DIRS} ) add_executable( char-server ${SOURCE_FILES} ) add_dependencies( char-server ${DEPENDENCIES} ) target_link_libraries( char-server ${LIBRARIES} ${DEPENDENCIES} ) -set_target_properties( char-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) +set_target_properties( char-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( WITH_COMPONENT_RUNTIME ) cpack_add_component( Runtime_charserver_txt DESCRIPTION "char-server (txt version)" DISPLAY_NAME "char-server" GROUP Runtime ) install( TARGETS char-server diff --git a/src/char_sql/CMakeLists.txt b/src/char_sql/CMakeLists.txt index 6090d3406..12c5b078f 100644 --- a/src/char_sql/CMakeLists.txt +++ b/src/char_sql/CMakeLists.txt @@ -39,7 +39,7 @@ set( SQL_CHAR_SOURCES set( DEPENDENCIES common_sql ) set( LIBRARIES ${GLOBAL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) -set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS}" ) set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ${SQL_CHAR_HEADERS} ${SQL_CHAR_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ) source_group( char FILES ${SQL_CHAR_HEADERS} ${SQL_CHAR_SOURCES} ) @@ -47,7 +47,7 @@ include_directories( ${INCLUDE_DIRS} ) add_executable( char-server_sql ${SOURCE_FILES} ) add_dependencies( char-server_sql ${DEPENDENCIES} ) target_link_libraries( char-server_sql ${LIBRARIES} ${DEPENDENCIES} ) -set_target_properties( char-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) +set_target_properties( char-server_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( WITH_COMPONENT_RUNTIME ) cpack_add_component( Runtime_charserver_sql DESCRIPTION "char-server (sql version)" DISPLAY_NAME "char-server_sql" GROUP Runtime ) install( TARGETS char-server_sql diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index a389a0b58..3fb95e5e0 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -48,7 +48,7 @@ set( COMMON_MINI_SOURCES "${COMMON_SOURCE_DIR}/showmsg.c" "${COMMON_SOURCE_DIR}/strlib.c" CACHE INTERNAL "" ) -set( COMMON_MINI_DEFINITIONS MINICORE CACHE INTERNAL "" ) +set( COMMON_MINI_DEFINITIONS "-DMINICORE" CACHE INTERNAL "" ) # @@ -95,13 +95,13 @@ set( COMMON_BASE_SOURCES CACHE INTERNAL "common_base sources" ) set( LIBRARIES ${ZLIB_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ) -set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS}" ) set( SOURCE_FILES ${MT19937AR_HEADERS} ${MT19937AR_SOURCES} ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} ) source_group( mt19937ar FILES ${MT19937AR_HEADERS} ${MT19937AR_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} ) add_library( common_base ${SOURCE_FILES} ) target_link_libraries( common_base ${LIBRARIES} ) -set_target_properties( common_base PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) +set_target_properties( common_base PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) include_directories( ${INCLUDE_DIRS} ) set( HAVE_common_base ON CACHE BOOL "common_base target is available" ) mark_as_advanced( HAVE_common_base ) @@ -128,13 +128,13 @@ set( COMMON_SQL_SOURCES set( DEPENDENCIES common_base ) set( LIBRARIES ${MYSQL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIRS} ) -set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS}" ) set( SOURCE_FILES ${COMMON_SQL_HEADERS} ${COMMON_SQL_SOURCES} ) source_group( common FILES ${COMMON_SQL_HEADERS} ${COMMON_SQL_SOURCES} ) add_library( common_sql ${SOURCE_FILES} ) add_dependencies( common_sql ${DEPENDENCIES} ) target_link_libraries( common_sql ${LIBRARIES} ${DEPENDENCIES} ) -set_target_properties( common_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) +set_target_properties( common_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) include_directories( ${INCLUDE_DIRS} ) set( HAVE_common_sql ON CACHE BOOL "common_sql target is available" ) mark_as_advanced( HAVE_common_sql ) diff --git a/src/login/sql/CMakeLists.txt b/src/login/sql/CMakeLists.txt index ed23ba684..85ad44e94 100644 --- a/src/login/sql/CMakeLists.txt +++ b/src/login/sql/CMakeLists.txt @@ -19,7 +19,7 @@ set( SQL_LOGIN_SOURCES set( DEPENDENCIES common_sql ) set( LIBRARIES ${GLOBAL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) -set( DEFINITIONS ${GLOBAL_DEFINITIONS} WITH_SQL ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} -DWITH_SQL" ) set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ${SQL_LOGIN_HEADERS} ${SQL_LOGIN_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ) source_group( login FILES ${SQL_LOGIN_HEADERS} ${SQL_LOGIN_SOURCES} ) @@ -27,7 +27,7 @@ include_directories( ${INCLUDE_DIRS} ) add_executable( login-server_sql ${SOURCE_FILES} ) add_dependencies( login-server_sql ${DEPENDENCIES} ) target_link_libraries( login-server_sql ${LIBRARIES} ${DEPENDENCIES} ) -set_target_properties( login-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) +set_target_properties( login-server_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( WITH_COMPONENT_RUNTIME ) cpack_add_component( Runtime_loginserver_sql DESCRIPTION "login-server (sql version)" DISPLAY_NAME "login-server_sql" GROUP Runtime ) install( TARGETS login-server_sql diff --git a/src/login/txt/CMakeLists.txt b/src/login/txt/CMakeLists.txt index 195de250e..a8d1246b7 100644 --- a/src/login/txt/CMakeLists.txt +++ b/src/login/txt/CMakeLists.txt @@ -19,7 +19,7 @@ set( TXT_LOGIN_SOURCES set( DEPENDENCIES common_base ) set( LIBRARIES ${GLOBAL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) -set( DEFINITIONS ${GLOBAL_DEFINITIONS} WITH_TXT ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} -DWITH_TXT" ) set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${TXT_LOGIN_HEADERS} ${TXT_LOGIN_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ) source_group( login FILES ${TXT_LOGIN_HEADERS} ${TXT_LOGIN_SOURCES} ) @@ -27,7 +27,7 @@ include_directories( ${INCLUDE_DIRS} ) add_executable( login-server ${SOURCE_FILES} ) add_dependencies( login-server ${DEPENDENCIES} ) target_link_libraries( login-server ${LIBRARIES} ${DEPENDENCIES} ) -set_target_properties( login-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) +set_target_properties( login-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( WITH_COMPONENT_RUNTIME ) cpack_add_component( Runtime_loginserver_txt DESCRIPTION "login-server (txt version)" DISPLAY_NAME "login-server" GROUP Runtime ) install( TARGETS login-server diff --git a/src/map/sql/CMakeLists.txt b/src/map/sql/CMakeLists.txt index ae16148d4..591e3e65b 100644 --- a/src/map/sql/CMakeLists.txt +++ b/src/map/sql/CMakeLists.txt @@ -80,12 +80,12 @@ set( SQL_MAP_SOURCES set( DEPENDENCIES common_sql ) set( LIBRARIES ${GLOBAL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) -set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS}" ) if( WITH_PCRE ) message( STATUS "Using PCRE" ) - list( APPEND LIBRARIES ${PCRE_LIBRARIES} ) - list( APPEND INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} ) - list( APPEND DEFINITIONS PCRE_SUPPORT ) + set( LIBRARIES ${LIBRARIES} ${PCRE_LIBRARIES} ) + set( INCLUDE_DIRS ${INCLUDE_DIRS} ${PCRE_INCLUDE_DIRS} ) + set( DEFINITIONS "${DEFINITIONS} -DPCRE_SUPPORT" ) endif() set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ${SQL_MAP_HEADERS} ${SQL_MAP_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ) @@ -94,7 +94,7 @@ include_directories( ${INCLUDE_DIRS} ) add_executable( map-server_sql ${SOURCE_FILES} ) add_dependencies( map-server_sql ${DEPENDENCIES} ) target_link_libraries( map-server_sql ${LIBRARIES} ${DEPENDENCIES} ) -set_target_properties( map-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) +set_target_properties( map-server_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( WITH_COMPONENT_RUNTIME ) cpack_add_component( Runtime_mapserver_sql DESCRIPTION "map-server (sql version)" DISPLAY_NAME "map-server_sql" GROUP Runtime ) install( TARGETS map-server_sql diff --git a/src/map/txt/CMakeLists.txt b/src/map/txt/CMakeLists.txt index 4e3bfbb0c..878ab68d2 100644 --- a/src/map/txt/CMakeLists.txt +++ b/src/map/txt/CMakeLists.txt @@ -80,12 +80,12 @@ set( TXT_MAP_SOURCES set( DEPENDENCIES common_base ) set( LIBRARIES ${GLOBAL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) -set( DEFINITIONS ${GLOBAL_DEFINITIONS} TXT_ONLY ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} -DTXT_ONLY" ) if( WITH_PCRE ) message( STATUS "Using PCRE" ) - list( APPEND LIBRARIES ${PCRE_LIBRARIES} ) - list( APPEND INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} ) - list( APPEND DEFINITIONS PCRE_SUPPORT ) + set( LIBRARIES ${LIBRARIES} ${PCRE_LIBRARIES} ) + set( INCLUDE_DIRS ${INCLUDE_DIRS} ${PCRE_INCLUDE_DIRS} ) + set( DEFINITIONS "${DEFINITIONS} -DPCRE_SUPPORT" ) endif() set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${TXT_MAP_HEADERS} ${TXT_MAP_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ) @@ -94,7 +94,7 @@ include_directories( ${INCLUDE_DIRS} ) add_executable( map-server ${SOURCE_FILES} ) add_dependencies( map-server ${DEPENDENCIES} ) target_link_libraries( map-server ${LIBRARIES} ${DEPENDENCIES} ) -set_target_properties( map-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) +set_target_properties( map-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( WITH_COMPONENT_RUNTIME ) cpack_add_component( Runtime_mapserver_txt DESCRIPTION "map-server (txt version)" DISPLAY_NAME "map-server" GROUP Runtime ) install( TARGETS map-server diff --git a/src/tool/CMakeLists.txt b/src/tool/CMakeLists.txt index df22e150a..26595b404 100644 --- a/src/tool/CMakeLists.txt +++ b/src/tool/CMakeLists.txt @@ -19,14 +19,14 @@ set( MAPCACHE_SOURCES ) set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ) -set( DEFINITIONS ${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS} ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS}" ) set( SOURCE_FILES ${COMMON_HEADERS} ${COMMON_SOURCES} ${MAPCACHE_SOURCES} ) source_group( common FILES ${COMMON_HEADERS} ${COMMON_SOURCES} ) source_group( mapcache FILES ${MAPCACHE_SOURCES} ) add_executable( mapcache ${SOURCE_FILES} ) include_directories( ${INCLUDE_DIRS} ) target_link_libraries( mapcache ${LIBRARIES} ) -set_target_properties( mapcache PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) +set_target_properties( mapcache PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( WITH_COMPONENT_RUNTIME ) cpack_add_component( Runtime_mapcache DESCRIPTION "mapcache generator" DISPLAY_NAME "mapcache" GROUP Runtime ) install( TARGETS mapcache diff --git a/src/txt-converter/char/CMakeLists.txt b/src/txt-converter/char/CMakeLists.txt index dab0df76a..ecdc28091 100644 --- a/src/txt-converter/char/CMakeLists.txt +++ b/src/txt-converter/char/CMakeLists.txt @@ -55,7 +55,7 @@ set( CONVERTER_SOURCES ) set( LIBRARIES ${GLOBAL_LIBRARIES} ${MYSQL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIRS} ) -set( DEFINITIONS ${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS} TXT_SQL_CONVERT ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS} -DTXT_SQL_CONVERT" ) set( SOURCE_FILES ${COMMON_HEADERS} ${COMMON_SOURCES} ${TXT_HEADERS} ${TXT_SOURCES} ${SQL_HEADERS} ${SQL_SOURCES} ${CONVERTER_SOURCES} ) source_group( common FILES ${COMMON_HEADERS} ${COMMON_SOURCES} ) source_group( txt FILES ${TXT_HEADERS} ${TXT_SOURCES} ) @@ -64,7 +64,7 @@ source_group( converter FILES ${CONVERTER_SOURCES} ) include_directories( ${INCLUDE_DIRS} ) add_executable( char-converter ${SOURCE_FILES} ) target_link_libraries( char-converter ${LIBRARIES} ) -set_target_properties( char-converter PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) +set_target_properties( char-converter PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( WITH_COMPONENT_RUNTIME ) cpack_add_component( Runtime_charconverter DESCRIPTION "char-converter" DISPLAY_NAME "char-converter" GROUP Runtime ) install( TARGETS char-converter diff --git a/src/txt-converter/login/CMakeLists.txt b/src/txt-converter/login/CMakeLists.txt index 8ae7665f4..8cf333438 100644 --- a/src/txt-converter/login/CMakeLists.txt +++ b/src/txt-converter/login/CMakeLists.txt @@ -39,7 +39,7 @@ set( CONVERTER_SOURCES ) set( LIBRARIES ${GLOBAL_LIBRARIES} ${MYSQL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIRS} ) -set( DEFINITIONS ${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS} WITH_TXT WITH_SQL ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS} -DWITH_TXT -DWITH_SQL" ) set( SOURCE_FILES ${COMMON_HEADERS} ${COMMON_SOURCES} ${TXT_HEADERS} ${TXT_SOURCES} ${SQL_HEADERS} ${SQL_SOURCES} ${CONVERTER_SOURCES} ) source_group( common FILES ${COMMON_HEADERS} ${COMMON_SOURCES} ) source_group( txt FILES ${TXT_HEADERS} ${TXT_SOURCES} ) @@ -48,7 +48,7 @@ source_group( converter FILES ${CONVERTER_SOURCES} ) include_directories( ${INCLUDE_DIRS} ) add_executable( login-converter ${SOURCE_FILES} ) target_link_libraries( login-converter ${LIBRARIES} ) -set_target_properties( login-converter PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) +set_target_properties( login-converter PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( WITH_COMPONENT_RUNTIME ) cpack_add_component( Runtime_loginconverter DESCRIPTION "login-converter" DISPLAY_NAME "login-converter" GROUP Runtime ) install( TARGETS login-converter |