1
0

Allow building MCADefrag at the same time as MCServer

This commit is contained in:
Tycho 2014-02-16 03:37:31 -08:00
parent 42e9b21fb2
commit 2acf218700
4 changed files with 106 additions and 120 deletions

View File

@ -3,6 +3,15 @@ cmake_minimum_required (VERSION 2.6)
# Without this, the MSVC variable isn't defined for MSVC builds ( http://www.cmake.org/pipermail/cmake/2011-November/047130.html )
enable_language(CXX C)
#THis has to be done before any flags have been set up.
if(${BUILD_TOOLS})
add_subdirectory(Tools/MCADefrag/)
endif()
if(${BUILD_UNSTABLE_TOOLS})
add_subdirectory(Tools/GeneratorPerformanceTest/)
endif()
include(SetFlags.cmake)
set_flags()
set_lib_flags()
@ -46,9 +55,5 @@ add_subdirectory(lib/polarssl/ EXCLUDE_FROM_ALL)
set_exe_flags()
if(${BUILD_TOOLS})
add_subdirectory(Tools/GeneratorPerformanceTest/)
endif()
add_subdirectory (src)

View File

@ -23,9 +23,6 @@ endmacro()
macro(set_flags)
if(NOT DEFINED ${FLAGS_SET})
set(FLAGS_SET 1)
# Add the preprocessor macros used for distinguishing between debug and release builds (CMake does this automatically for MSVC):
if (NOT MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
@ -88,13 +85,9 @@ macro(set_flags)
string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
endif()
endif()
endmacro()
macro(set_lib_flags)
if(NOT DEFINED ${LIB_FLAGS_SET})
set(LIB_FLAGS_SET 1)
# Set lower warnings-level for the libraries:
if (MSVC)
# Remove /W3 from command line -- cannot just cancel it later with /w like in unix, MSVC produces a D9025 warning (option1 overriden by option2)
@ -119,15 +112,9 @@ macro(set_lib_flags)
set(DYNAMIC_LOADER dl)
endif()
endif()
endif()
endmacro()
macro(enable_profile)
if(NOT DEFINED ${PROFILE_ENABLED})
set(PROFILE_ENABLED 1)
# Declare the flags used for profiling builds:
if (MSVC)
set (CXX_PROFILING "")
@ -184,13 +171,9 @@ macro(enable_profile)
CMAKE_SHARED_LINKER_FLAGS_RELEASEPROFILE )
# The configuration types need to be set after their respective c/cxx/linker flags and before the project directive
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugProfile;ReleaseProfile" CACHE STRING "" FORCE)
endif()
endmacro()
macro(set_exe_flags)
if(NOT DEFINED ${EXE_FLAGS_SET})
set(EXE_FLAGS_SET 1)
# Remove disabling the maximum warning level:
# clang does not like a command line that reads -Wall -Wextra -w -Wall -Wextra and does not output any warnings
# We do not do that for MSVC since MSVC produces an awful lot of warnings for its own STL headers;
@ -203,6 +186,4 @@ macro(set_exe_flags)
add_flags_cxx("-Wall")
endif()
endif()
endmacro()

View File

@ -30,10 +30,8 @@ endfunction()
# Include the libraries:
if(NOT DEFINED ${ZLIB})
add_subdirectory(../../lib/zlib lib/zlib)
set(ZLIB 1)
endif()
set_exe_flags()

View File

@ -8,6 +8,7 @@ file(GLOB SOURCE
"*.c"
)
if(NOT TARGET zlib)
add_library(zlib ${SOURCE})
if (MSVC)
@ -16,4 +17,5 @@ if (MSVC)
zlib PROPERTIES COMPILE_FLAGS "-D_CRT_SECURE_NO_WARNINGS"
)
endif()
endif()