Permalink
Browse files

And even more CMake-specific cleanups (mutes most of the "non-harmful…

…" warnings - VS is just trying to be too friendly/noisy at times)

--HG--
branch : trunk
  • Loading branch information...
1 parent fc1ed4b commit f8bb7afa9817411beda1f2492d18c61679e9a5f9 click committed Jun 30, 2010
View
@@ -57,6 +57,7 @@ if( NOT CMAKE_BUILD_TYPE )
set(CMAKE_BUILD_TYPE "Release")
endif()
+if( UNIX )
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@@ -66,6 +67,7 @@ configure_file(
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
)
+endif()
option(DO_AUTHSERVER "Build authserver" 1)
option(DO_WORLDSERVER "Build worldserver" 1)
@@ -100,27 +102,49 @@ set(GENREV_SRC
# Handle debugmode compiles (this will require further work for proper WIN32-setups)
if( DO_DEBUG )
set(CMAKE_BUILD_TYPE Debug)
+
add_executable(genrev
${GENREV_SRC}
)
- add_custom_target("revision.h" ALL
- COMMAND "${CMAKE_BINARY_DIR}/genrev"
- ${CMAKE_SOURCE_DIR}
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
- DEPENDS genrev
- )
+ if( CMAKE_GENERATOR MATCHES "Visual Studio" )
+ add_custom_target("revision.h" ALL
+ COMMAND "${CMAKE_CURRENT_BINARY_DIR}/$(ConfigurationName)/genrev"
+ ${CMAKE_SOURCE_DIR}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPENDS genrev
+ )
+ else()
+ add_custom_target("revision.h" ALL
+ COMMAND "${CMAKE_CURRENT_BINARY_DIR}/genrev"
+ ${CMAKE_SOURCE_DIR}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPENDS genrev
+ )
+ endif()
+
else()
+
add_executable(genrev
${GENREV_SRC}
)
- add_custom_target("revision.h" ALL
- COMMAND "${CMAKE_BINARY_DIR}/genrev"
- ${CMAKE_SOURCE_DIR}
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
- DEPENDS genrev
- )
+ if( CMAKE_GENERATOR MATCHES "Visual Studio" )
+ add_custom_target("revision.h" ALL
+ COMMAND "${CMAKE_CURRENT_BINARY_DIR}/$(ConfigurationName)/genrev"
+ ${CMAKE_SOURCE_DIR}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPENDS genrev
+ )
+ else()
+ add_custom_target("revision.h" ALL
+ COMMAND "${CMAKE_CURRENT_BINARY_DIR}/genrev"
+ ${CMAKE_SOURCE_DIR}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+ DEPENDS genrev
+ )
+ endif()
+
endif()
execute_process(
@@ -209,12 +233,13 @@ else()
elseif( WIN32 )
# Disable warnings in Visual Studio 8 and above
if(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7")
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996")
- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /wd4996")
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996")
- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4996")
- set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /wd4996")
- set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4996")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996 /wd4355 /wd4244 /wd4267")
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267")
+
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267")
+ set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267")
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267")
endif()
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
@@ -8,15 +8,24 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-file(GLOB sources *.c)
-file(GLOB headers *.h)
SET(zlib_STAT_SRCS
- ${sources}
- )
+ adler32.c
+ compress.c
+ crc32.c
+ deflate.c
+ example.c
+ infback.c
+ inffast.c
+ inflate.c
+ inftrees.c
+ trees.c
+ uncompr.c
+ zutil.c
+)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
- )
+)
add_library(zlib STATIC ${zlib_STAT_SRCS})
@@ -57,29 +57,30 @@ endif()
set_target_properties(authserver PROPERTIES LINK_FLAGS "${authserver_LINK_FLAGS}")
if(WIN32)
-target_link_libraries(
- authserver
- shared
- trinitydatabase
- trinityauth
- trinityconfig
- ${MYSQL_LIBRARY}
- ${OPENSSL_LIBRARIES}
- ${OPENSSL_EXTRA_LIBRARIES}
-)
+ target_link_libraries(
+ authserver
+ shared
+ trinitydatabase
+ trinityauth
+ trinityconfig
+ ${MYSQL_LIBRARY}
+ ${OPENSSL_LIBRARIES}
+ ${OPENSSL_EXTRA_LIBRARIES}
+ )
else()
-target_link_libraries(
- authserver
- shared
- trinitydatabase
- trinityauth
- trinityconfig
- ${MYSQL_LIBRARY}
- ${OPENSSL_LIBRARIES}
- ${OSX_LIBS}
-)
+ target_link_libraries(
+ authserver
+ shared
+ trinitydatabase
+ trinityauth
+ trinityconfig
+ ${MYSQL_LIBRARY}
+ ${OPENSSL_LIBRARIES}
+ ${OSX_LIBS}
+ )
endif()
-########### install files ###############
-install(TARGETS authserver DESTINATION bin)
-install(FILES authserver.conf.dist DESTINATION etc)
+if( UNIX )
+ install(TARGETS authserver DESTINATION bin)
+ install(FILES authserver.conf.dist DESTINATION etc)
+endif()
@@ -140,8 +140,9 @@ if(DO_SCRIPTS)
else(DO_SCRIPTS)
set(SCRIPT_LIB "")
endif(DO_SCRIPTS)
+
if(WIN32)
- target_link_libraries(
+ target_link_libraries(
worldserver
game
shared
@@ -181,7 +182,7 @@ else()
)
endif()
-########### install files ###############
-
-install(TARGETS worldserver DESTINATION bin)
-install(FILES worldserver.conf.dist DESTINATION etc)
+if( UNIX )
+ install(TARGETS worldserver DESTINATION bin)
+ install(FILES worldserver.conf.dist DESTINATION etc)
+endif()
@@ -33,4 +33,6 @@ else()
)
endif()
-install(TARGETS mapextractor DESTINATION bin)
+if( UNIX )
+ install(TARGETS mapextractor DESTINATION bin)
+endif()
@@ -37,4 +37,6 @@ else()
)
endif()
-install(TARGETS vmap3assembler DESTINATION bin)
+if( UNIX )
+ install(TARGETS vmap3assembler DESTINATION bin)
+if()
@@ -36,4 +36,6 @@ else()
)
endif()
-install(TARGETS vmap3extractor DESTINATION bin)
+if( UNIX )
+ install(TARGETS vmap3extractor DESTINATION bin)
+endif()

0 comments on commit f8bb7af

Please sign in to comment.