diff options
-rw-r--r-- | 3rdparty/CMakeLists.txt | 33 | ||||
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/char/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/common/CMakeLists.txt | 18 | ||||
-rw-r--r-- | src/login/sql/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/map/sql/CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/plugins/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/tool/CMakeLists.txt | 8 |
8 files changed, 60 insertions, 34 deletions
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 3b60b68dc..41916ec48 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -2,19 +2,23 @@ # macro to configure the use of local or system version of a package # Uses: # HAVE_LOCAL_${name} - is local version available? +# ${name}_LOCAL_DEPENDENCIES - dependencies of the local version # ${name}_LOCAL_LIBRARIES - libraries of the local version # ${name}_LOCAL_INCLUDE_DIRS - include directories of the local version +# ${name}_LOCAL_DEFINITIONS - definitions of the local version # HAVE_SYSTEM_${name} - is system version available? +# ${name}_SYSTEM_DEPENDENCIES - dependencies of the system version # ${name}_SYSTEM_LIBRARIES - libraries of the system version # ${name}_SYSTEM_INCLUDE_DIRS - include directories of the system version +# ${name}_SYSTEM_DEFINITIONS - definitions of the system version # Generates: # WITH_LOCAL_${name} - use the local version of the package (only when local is available) # WITH_${name} - use this package +# ${name}_DEPENDENCIES - dependencies # ${name}_LIBRARIES - libraries # ${name}_INCLUDE_DIRS - include directories +# ${name}_DEFINITIONS - definitions macro( CONFIGURE_WITH_LOCAL_OR_SYSTEM name ) - unset( ${name}_LIBRARIES CACHE ) - unset( ${name}_INCLUDE_DIRS CACHE ) if( HAVE_LOCAL_${name} ) set( WITH_LOCAL_${name} ON CACHE BOOL "use local version of ${name}" ) @@ -22,14 +26,9 @@ macro( CONFIGURE_WITH_LOCAL_OR_SYSTEM name ) unset( WITH_LOCAL_${name} CACHE ) endif() if( WITH_LOCAL_${name} ) - message( STATUS "Configuring for local ${name}" ) - set( ${name}_LIBRARIES ${${name}_LOCAL_LIBRARIES} ) - set( ${name}_INCLUDE_DIRS ${${name}_LOCAL_INCLUDE_DIRS} ) - message( STATUS "Configuring for local ${name} - done" ) + set( _type "LOCAL" ) elseif( HAVE_SYSTEM_${name} ) - message( STATUS "Configuring for system ${name}" ) - set( ${name}_LIBRARIES ${${name}_SYSTEM_LIBRARIES} ) - set( ${name}_INCLUDE_DIRS ${${name}_SYSTEM_INCLUDE_DIRS} ) + set( _type "SYSTEM" ) message( STATUS "Configuring for system ${name} - done" ) endif() if( WITH_LOCAL_${name} OR HAVE_SYSTEM_${name} ) @@ -38,12 +37,24 @@ macro( CONFIGURE_WITH_LOCAL_OR_SYSTEM name ) else() unset( WITH_${name} CACHE ) endif() - set( ${name}_LIBRARIES ${${name}_LIBRARIES} + message( STATUS "Configuring for ${_type} ${name}" ) + unset( ${name}_DEPENDENCIES CACHE ) + unset( ${name}_LIBRARIES CACHE ) + unset( ${name}_INCLUDE_DIRS CACHE ) + unset( ${name}_DEFINITIONS CACHE ) + set( ${name}_DEPENDENCIES ${${name}_${_type}_DEPENDENCIES} + CACHE PATH "${name} dependencies" ) + set( ${name}_LIBRARIES ${${name}_${_type}_LIBRARIES} CACHE PATH "${name} libraries" ) - set( ${name}_INCLUDE_DIRS ${${name}_INCLUDE_DIRS} + set( ${name}_INCLUDE_DIRS ${${name}_${_type}_INCLUDE_DIRS} CACHE PATH "${name} include directories" ) + set( ${name}_DEFINITIONS ${${name}_${_type}_DEFINITIONS} + CACHE PATH "${name} definitions" ) + mark_as_advanced( ${name}_DEPENDENCIES ) mark_as_advanced( ${name}_LIBRARIES ) mark_as_advanced( ${name}_INCLUDE_DIRS ) + mark_as_advanced( ${name}_DEFINITIONS ) + message( STATUS "Configuring for ${_type} ${name} - done" ) endmacro( CONFIGURE_WITH_LOCAL_OR_SYSTEM ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83e021fc3..4d0771254 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -572,9 +572,7 @@ add_subdirectory( src ) ##################################################################### # final checks and warnings # -if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - message( WARNING "64bit should work, but is not recommended." ) -elseif( NOT CMAKE_SIZEOF_VOID_P EQUAL 4 ) +if( NOT (CMAKE_SIZEOF_VOID_P EQUAL 4) AND NOT (CMAKE_SIZEOF_VOID_P EQUAL 8) ) message( FATAL_ERROR "unexpected architecture (CMAKE_SIZEOF_VOID_P is ${CMAKE_SIZEOF_VOID_P})" ) endif() list( LENGTH TARGET_LIST _LEN ) diff --git a/src/char/CMakeLists.txt b/src/char/CMakeLists.txt index 22b793bef..df32e758d 100644 --- a/src/char/CMakeLists.txt +++ b/src/char/CMakeLists.txt @@ -39,7 +39,7 @@ set( SQL_CHAR_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/inter.c" ) set( DEPENDENCIES common_sql ) -set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( LIBRARIES ${GLOBAL_LIBRARIES} common_sql ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} ) set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" ) set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ${SQL_CHAR_HEADERS} ${SQL_CHAR_SOURCES} ) @@ -47,8 +47,10 @@ source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ) source_group( char FILES ${SQL_CHAR_HEADERS} ${SQL_CHAR_SOURCES} ) 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} ) +if( DEPENDENCIES ) + add_dependencies( char-server_sql ${DEPENDENCIES} ) +endif() +target_link_libraries( char-server_sql ${LIBRARIES} ) set_target_properties( char-server_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_charserver_sql DESCRIPTION "char-server (sql version)" DISPLAY_NAME "char-server_sql" GROUP Runtime ) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index effd0b2ab..f37819188 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -101,6 +101,7 @@ set( COMMON_BASE_SOURCES "${COMMON_SOURCE_DIR}/utils.c" ${LIBCONFIG_SOURCES} # needed by conf.c/showmsg.c CACHE INTERNAL "common_base sources" ) +set( DEPENDENCIES ${ZLIB_DEPENDENCIES} ) set( COMMON_BASE_INCLUDE_DIRS ${LIBCONFIG_INCLUDE_DIRS} CACHE INTERNAL "common_base include dirs" ) @@ -109,11 +110,14 @@ set( COMMON_BASE_DEFINITIONS CACHE INTERNAL "common_base definitions" ) set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} ) -set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS} ${ZLIB_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} ) +if( DEPENDENCIES ) + add_dependencies( common_base ${DEPENDENCIES} ) +endif() target_link_libraries( common_base ${LIBRARIES} ) set_target_properties( common_base PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) include_directories( ${INCLUDE_DIRS} ) @@ -138,15 +142,17 @@ set( COMMON_SQL_HEADERS set( COMMON_SQL_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/sql.c" CACHE INTERNAL "common_sql sources" ) -set( DEPENDENCIES common_base ) -set( LIBRARIES ${GLOBAL_LIBRARIES} ${MYSQL_LIBRARIES} ) +set( DEPENDENCIES common_base ${MYSQL_DEPENDENCIES} ) +set( LIBRARIES ${GLOBAL_LIBRARIES} common_base ${MYSQL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIRS} ) -set( DEFINITIONS "${GLOBAL_DEFINITIONS}" ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${MYSQL_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} ) +if( DEPENDENCIES ) + add_dependencies( common_sql ${DEPENDENCIES} ) +endif() +target_link_libraries( common_sql ${LIBRARIES} ) set_target_properties( common_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) include_directories( ${INCLUDE_DIRS} ) set( HAVE_common_sql ON CACHE INTERNAL "" ) diff --git a/src/login/sql/CMakeLists.txt b/src/login/sql/CMakeLists.txt index 1355f17ee..16d48df64 100644 --- a/src/login/sql/CMakeLists.txt +++ b/src/login/sql/CMakeLists.txt @@ -17,7 +17,7 @@ set( SQL_LOGIN_SOURCES "${SQL_LOGIN_SOURCE_DIR}/loginlog_sql.c" ) set( DEPENDENCIES common_sql ) -set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( LIBRARIES ${GLOBAL_LIBRARIES} common_sql ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} ) set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS} -DWITH_SQL" ) set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ${SQL_LOGIN_HEADERS} ${SQL_LOGIN_SOURCES} ) @@ -25,8 +25,10 @@ source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ) source_group( login FILES ${SQL_LOGIN_HEADERS} ${SQL_LOGIN_SOURCES} ) 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} ) +if( DEPENDENCIES ) + add_dependencies( login-server_sql ${DEPENDENCIES} ) +endif() +target_link_libraries( login-server_sql ${LIBRARIES} ) set_target_properties( login-server_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_loginserver_sql DESCRIPTION "login-server (sql version)" DISPLAY_NAME "login-server_sql" GROUP Runtime ) diff --git a/src/map/sql/CMakeLists.txt b/src/map/sql/CMakeLists.txt index 47c8e495c..bf2d7cefa 100644 --- a/src/map/sql/CMakeLists.txt +++ b/src/map/sql/CMakeLists.txt @@ -82,14 +82,15 @@ set( SQL_MAP_SOURCES "${SQL_MAP_SOURCE_DIR}/vending.c" ) set( DEPENDENCIES common_sql ) -set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( LIBRARIES ${GLOBAL_LIBRARIES} common_sql ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} ) set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" ) if( WITH_PCRE ) message( STATUS "Enabled PCRE code" ) + set( DEPENDENCIES ${DEPENDENCIES} ${PCRE_DEPENDENCIES} ) set( LIBRARIES ${LIBRARIES} ${PCRE_LIBRARIES} ) set( INCLUDE_DIRS ${INCLUDE_DIRS} ${PCRE_INCLUDE_DIRS} ) - set( DEFINITIONS "${DEFINITIONS} -DPCRE_SUPPORT" ) + set( DEFINITIONS "${DEFINITIONS} ${PCRE_DEFINITIONS} -DPCRE_SUPPORT" ) else() message( STATUS "Disabled PCRE code" ) endif() @@ -98,8 +99,10 @@ source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ) source_group( map FILES ${SQL_MAP_HEADERS} ${SQL_MAP_SOURCES} ) 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} ) +if( DEPENDENCIES ) + add_dependencies( map-server_sql ${DEPENDENCIES} ) +endif() +target_link_libraries( map-server_sql ${LIBRARIES} ) set_target_properties( map-server_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_mapserver_sql DESCRIPTION "map-server (sql version)" DISPLAY_NAME "map-server_sql" GROUP Runtime ) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 21ffc3994..2bc7151a9 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -41,7 +41,7 @@ endif( BUILD_PLUGIN_console ) # # dbghelpplug # -if( WIN32 ) +if( WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4 ) find_path( HAVE_DBGHELP_H dbghelp.h ) mark_as_advanced( HAVE_DBGHELP_H ) if( HAVE_DBGHELP_H ) @@ -49,7 +49,7 @@ if( WIN32 ) endif() endif() if( NOT DEFINED BUILD_PLUGIN_dbghelpplug ) - message( STATUS "Disabled dbghelpplug plugin target (requires WIN32 and HAVE_DBGHELP_H)" ) + message( STATUS "Disabled dbghelpplug plugin target (requires WIN32 and CMAKE_SIZEOF_VOID_P=4 and HAVE_DBGHELP_H)" ) endif() if( BUILD_PLUGIN_dbghelpplug ) message( STATUS "Creating target dbghelpplug" ) diff --git a/src/tool/CMakeLists.txt b/src/tool/CMakeLists.txt index a54ffa0e2..434cbbfe6 100644 --- a/src/tool/CMakeLists.txt +++ b/src/tool/CMakeLists.txt @@ -24,16 +24,20 @@ set( COMMON_SOURCES set( MAPCACHE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/mapcache.c" ) +set( DEPENDENCIES ${ZLIB_DEPENDENCIES} ) set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_MINI_INCLUDE_DIRS} ) -set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS}" ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS} ${ZLIB_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} ) +if( DEPENDENCIES ) + add_dependencies( mapcache ${DEPENDENCIES} ) +endif() target_link_libraries( mapcache ${LIBRARIES} ) set_target_properties( mapcache PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) +include_directories( ${INCLUDE_DIRS} ) if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_mapcache DESCRIPTION "mapcache generator" DISPLAY_NAME "mapcache" GROUP Runtime ) install( TARGETS mapcache |