CMakeLists.txt
changeset 3495 a6b4f351d400
parent 3407 dcc129c4352e
child 3510 23145a950eae
--- a/CMakeLists.txt	Fri Jun 04 20:50:24 2010 +0000
+++ b/CMakeLists.txt	Sat Jun 05 14:07:58 2010 +0000
@@ -39,6 +39,14 @@
 #	MESSAGE(FATAL_ERROR "In-tree-build detected!")
 #ENDIF (${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR})
 
+#set some safe values
+IF(NOT WITH_SERVER)
+	SET(WITH_SERVER 0)
+ENDIF(NOT WITH_SERVER)
+IF(NOT BUILD_ENGINE_LIBRARY)
+	SET(BUILD_ENGINE_LIBRARY 0)
+ENDIF(NOT BUILD_ENGINE_LIBRARY)
+
 
 if(APPLE)
 	set(CMAKE_FIND_FRAMEWORK "FIRST")
@@ -92,17 +100,18 @@
 		set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk/")
 		if(current_macosx_version MATCHES "10.4")
 			find_package(SDL_mixer REQUIRED)
-			set(pascal_compiler_flags_cmn "-k-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg" ${pascal_compiler_flags_cmn})
-			set(pascal_compiler_flags_cmn "-k-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod" ${pascal_compiler_flags_cmn})
+			set(pascal_compiler_flags_cmn "-k-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg" "-k-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod" ${pascal_compiler_flags_cmn})
 			set(CMAKE_C_FLAGS "-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg -dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod")
 		endif()
 	else()
 		set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${minimum_macosx}.sdk/")
 	endif()
 
-	#1.set deployment target; 2.link with libsdlmain.a; 3.link with liblua.a (which requires readline)
+	#1.set deployment target; 2.link with libsdlmain.a (when building an executable); 3.link with liblua.a (which requires readline)
 	set(pascal_compiler_flags_cmn "-k-macosx_version_min" "-k${minimum_macosx}" "-XR${CMAKE_OSX_SYSROOT}" ${pascal_compiler_flags_cmn})
-	set(pascal_compiler_flags_cmn "-k${CMAKE_BINARY_DIR}/bin/libSDLmain.a" ${pascal_compiler_flags_cmn})
+	if(NOT BUILD_ENGINE_LIBRARY)
+		set(pascal_compiler_flags_cmn "-k${CMAKE_BINARY_DIR}/bin/libSDLmain.a" ${pascal_compiler_flags_cmn})
+	endif()
 	set(pascal_compiler_flags_cmn "-k${CMAKE_BINARY_DIR}/bin/liblua.a" "-k-lreadline" ${pascal_compiler_flags_cmn})
 else(APPLE)
 	set(target_dir "bin")
@@ -161,6 +170,7 @@
 set(HEDGEWARS_PROTO_VER 32)
 
 if(WITH_SERVER)
+	message(STATUS "Server is going to be built! Make sure you have GHC installed")
 	set(HAVE_NETSERVER true)
 	add_subdirectory(gameServer)
 else(WITH_SERVER)