From 1cf6502be23ff78e07a96b906738c97805120ca0 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 27 Dec 2013 11:51:08 +0100 Subject: Made cmake compilation possible on Windows. --- src/CMakeLists.txt | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 107ca60dd..88e469b74 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -49,9 +49,15 @@ else () source_group("" FILES ${SOURCE}) # Precompiled headers (1st part) - SET(PrecompiledBinary "$(IntDir)/Globals.pch") SET_SOURCE_FILES_PROPERTIES( - Globals.cpp PROPERTIES COMPILE_FLAGS "/Yc\"Globals.h\" /Fp\"${PrecompiledBinary}\"" + Globals.cpp PROPERTIES COMPILE_FLAGS "/Yc\"Globals.h\"" + ) + # CMake cannot "remove" the precompiled header flags, so we use a dummy precompiled header compatible with just this one file: + SET_SOURCE_FILES_PROPERTIES( + Bindings/Bindings.cpp PROPERTIES COMPILE_FLAGS "/Yc\"string.h\" /Fp\"$(IntDir)/Bindings.pch\"" + ) + SET_SOURCE_FILES_PROPERTIES( + "StackWalker.cpp LeakFinder.h" PROPERTIES COMPILE_FLAGS "/Yc\"Globals.h\"" ) endif() @@ -66,10 +72,11 @@ endif () add_executable(${EXECUTABLE} ${SOURCE}) +# Precompiled headers (2nd part) if (WIN32) SET_TARGET_PROPERTIES( - ${EXECUTABLE} PROPERTIES COMPILE_FLAGS "/Yu\"Globals.h\" /FI\"${PrecompiledBinary}\" /Fp\"${PrecompiledBinary}\"" - OBJECT_DEPENDS "${PrecompiledBinary}" + ${EXECUTABLE} PROPERTIES COMPILE_FLAGS "/Yu\"Globals.h\"" + OBJECT_DEPENDS "$(IntDir)/$(TargetName.pch)" ) endif () @@ -79,4 +86,7 @@ if (NOT WIN32) target_link_libraries(${EXECUTABLE} Protocol Generating WorldStorage) target_link_libraries(${EXECUTABLE} Mobs Entities Simulator UI BlockEntities) endif () -target_link_libraries(${EXECUTABLE} md5 luaexpat iniFile jsoncpp cryptopp zlib lua) +if (WIN32) + target_link_libraries(${EXECUTABLE} expat tolualib ws2_32.lib Psapi.lib) +endif() +target_link_libraries(${EXECUTABLE} md5 luaexpat iniFile jsoncpp cryptopp zlib lua sqlite) -- cgit v1.2.3