Cleaned cMake, removed old Windows only implementation for the precompiled headers with one provided by cMake

Cleaned cMake, removed old Windows only implementation for the precompiled headers with one provided by cMake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 32ef219..74c6e49 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,14 +4,13 @@
 # cmake required (http://www.cmake.org/)
 #
 
-cmake_minimum_required( VERSION 2.8 )
+cmake_minimum_required( VERSION 3.16 )
 
 if( POLICY CMP0017 )
   cmake_policy( SET CMP0017 NEW )
 endif()
 
 include( CMakeDependentOption )
-include( cmake/precompiledHeaders.cmake )
 
 set( GAME_APP_NAME "" CACHE            STRING "The Application name")
 set( GAME_APP_VERSION "" CACHE         STRING "The Application version")
@@ -349,15 +348,17 @@ if( MSVC )
 
 	target_link_libraries( sgame winmm.lib )
 
-	ADD_PRECOMPILED_HEADER( sgame "${TREMGAME_DIR}/sgame/sgame_precompiled.h" "${TREMGAME_DIR}/sgame/sgame_precompiled.cpp" )
 	SET_TARGET_PROPERTIES( sgame PROPERTIES LINK_FLAGS "/DEF:\"${TREMGAME_DIR}/sgame/sgame.def" )
 endif( MSVC )
 
+	target_precompile_headers( sgame PRIVATE "${TREMGAME_DIR}/sgame/sgame_precompiled.h" )
+
 find_package( Bullet REQUIRED )
 
 TARGET_INCLUDE_DIRECTORIES( sgame PRIVATE ${MOUNT_DIR} ${TREMGAME_DIR} ${BULLET_INCLUDE_DIRS} ${BULLET_INCLUDE_DIR} ${BULLET_INCLUDE_COLLISION_DIR} ${BULLET_INCLUDE_DYNAMICS_DIR} ${BULLET_INCLUDE_SOFTBODY_DIR} ${BULLET_INCLUDE_LINEARMATH_DIR} ${BULLET_INCLUDE_FILELOADER_DIR} ${BULLET_INCLUDE_WORLDIMPORTER_DIR} )
 
 if(MSVC)
+	target_compile_options(sgame PRIVATE "/MP")
 	set_property( TARGET sgame PROPERTY COMPILE_DEFINITIONS _AMD64_ WIN32 _AMD64 _WIN64 __WIN64__ GAMEDLL )
 elseif( UNIX )
 	set_property( TARGET sgame PROPERTY COMPILE_DEFINITIONS LINUX __amd64__ __linux__ __x86_64__ __LINUX__ GAMEDLL )
@@ -382,12 +383,15 @@ if( MSVC )
 	SOURCE_GROUP( Source\ Files\\SharedList                               FILES ${SHAREDLIST_SOURCES} )
 	SOURCE_GROUP( Source\ Files\\GameFiles                                FILES ${CGAMELIST_SOURCES} )
 	
-	ADD_PRECOMPILED_HEADER( cgame "${TREMGAME_DIR}/cgame/cgame_precompiled.h" "${TREMGAME_DIR}/cgame/cgame_precompiled.cpp" )	
 	SET_TARGET_PROPERTIES( cgame PROPERTIES LINK_FLAGS "/DEF:\"${TREMGAME_DIR}/cgame/cgame.def" )
 endif( MSVC )
 
-TARGET_INCLUDE_DIRECTORIES( cgame PRIVATE ${MOUNT_DIR} ${TREMGAME_DIR} )
+	target_precompile_headers( cgame PRIVATE "${TREMGAME_DIR}/cgame/cgame_precompiled.h" )
+
+	TARGET_INCLUDE_DIRECTORIES( cgame PRIVATE ${MOUNT_DIR} ${TREMGAME_DIR} )
+	
 if(MSVC)
+	target_compile_options(cgame PRIVATE "/MP")
 	set_property( TARGET cgame PROPERTY COMPILE_DEFINITIONS _AMD64_ NDEBUG _WIN32 WIN32 _AMD64 _WIN64 __WIN64__ CGAMEDLL )
 elseif( UNIX )
 	set_property( TARGET cgame PROPERTY COMPILE_DEFINITIONS LINUX __amd64__ __linux__ __x86_64__ __LINUX__ CGAMEDLL )
@@ -408,12 +412,15 @@ if( MSVC )
 	SOURCE_GROUP( Source\ Files\\SharedList                               FILES ${SHAREDLIST_SOURCES} )
 	SOURCE_GROUP( Source\ Files\\GameFiles                                FILES ${GUI_SOURCES} )
 	
-	ADD_PRECOMPILED_HEADER( gui "${TREMGAME_DIR}/GUI/gui_precompiled.h" "${TREMGAME_DIR}/GUI/gui_precompiled.cpp" )	
 	SET_TARGET_PROPERTIES( gui PROPERTIES LINK_FLAGS "/DEF:\"${TREMGAME_DIR}/GUI/gui.def" )
 endif( MSVC )
 
-TARGET_INCLUDE_DIRECTORIES( gui PRIVATE ${MOUNT_DIR} ${TREMGAME_DIR} )
+	target_precompile_headers( gui PRIVATE "${TREMGAME_DIR}/GUI/gui_precompiled.h" )
+
+	TARGET_INCLUDE_DIRECTORIES( gui PRIVATE ${MOUNT_DIR} ${TREMGAME_DIR} )
+	
 if(MSVC)
+	target_compile_options(gui PRIVATE "/MP")
 	set_property( TARGET gui PROPERTY COMPILE_DEFINITIONS _AMD64_ NDEBUG _WIN32 WIN32 _AMD64 _WIN64 __WIN64__ GUI )
 elseif( UNIX )
 	set_property( TARGET gui PROPERTY COMPILE_DEFINITIONS LINUX __amd64__ __linux__ __x86_64__ __LINUX__ GUI )
diff --git a/cmake/precompiledHeaders.cmake b/cmake/precompiledHeaders.cmake
deleted file mode 100644
index 26ec908..0000000
--- a/cmake/precompiledHeaders.cmake
+++ /dev/null
@@ -1,23 +0,0 @@
-# set PCH for VS project
-function(ADD_PRECOMPILED_HEADER TargetName PrecompiledHeader PrecompiledSource)
-  if(MSVC)
-    get_filename_component(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
-    set(PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${PrecompiledBasename}.pch")
-
-    set_target_properties(${TargetName}
-      PROPERTIES
-        COMPILE_FLAGS "/Yu\"${PrecompiledHeader}\" /FI\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""
-        OBJECT_DEPENDS "${PrecompiledBinary}")
-    set_source_files_properties(${PrecompiledSource}
-      PROPERTIES
-        COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""
-        OBJECT_OUTPUTS "${PrecompiledBinary}")
-  endif(MSVC)
-endfunction(ADD_PRECOMPILED_HEADER)
-
-# ignore PCH for a specified list of files
-function(IGNORE_PRECOMPILED_HEADER SourcesVar)
-  if(MSVC)  
-    set_source_files_properties(${${SourcesVar}} PROPERTIES COMPILE_FLAGS "/Y-")
-  endif(MSVC)
-endfunction(IGNORE_PRECOMPILED_HEADER)

GitHub
sha: 189b424c

© GrangerHub. All rights reserved. Tremulous © Darklegion Development. Granger by err-overflow and MoP licensed CC-BY-SA-2.5