File tree Expand file tree Collapse file tree 2 files changed +9
-13
lines changed
Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -148,13 +148,10 @@ if(XCODE OR VS)
148148 cocos_mark_code_files("cocos2d" )
149149endif ()
150150
151- if (WINDOWS)
152- # precompiled header. Compilation time speedup ~4x.
153- target_sources (cocos2d PUBLIC "${CMAKE_CURRENT_SOURCE_DIR} /precheader.cpp" )
154- set_target_properties (cocos2d PROPERTIES COMPILE_FLAGS "/Yuprecheader.h /FIprecheader.h" )
155- set_source_files_properties ("${CMAKE_CURRENT_SOURCE_DIR} /precheader.cpp" PROPERTIES COMPILE_FLAGS "/Ycprecheader.h" )
156- # compile c as c++. needed for precompiled header
157- set_source_files_properties (${COCOS_SPINE_SRC} base/ccFPSImages.c PROPERTIES LANGUAGE CXX)
151+ if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0" )
152+ message ("CMake 3.16 target_precompile_headers" )
153+ target_precompile_headers(cocos2d PRIVATE
154+ "$<$<COMPILE_LANGUAGE:CXX>:cocos2d.h>" )
158155endif ()
159156
160157#if(XCODE)
Original file line number Diff line number Diff line change @@ -425,9 +425,8 @@ if(LINUX OR WINDOWS)
425425 cocos_copy_target_res(${APP_NAME} LINK_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER} )
426426endif ()
427427
428- if (WINDOWS)
429- # precompiled header. Compilation time speedup ~4x.
430- target_sources (${APP_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR} /Classes/precheader.cpp" )
431- set_target_properties (${APP_NAME} PROPERTIES COMPILE_FLAGS "/Yuprecheader.h /FIprecheader.h" )
432- set_source_files_properties ("${CMAKE_CURRENT_SOURCE_DIR} /Classes/precheader.cpp" PROPERTIES COMPILE_FLAGS "/Ycprecheader.h" )
433- endif ()
428+ if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0" )
429+ message ("CMake 3.16 target_precompile_headers" )
430+ target_precompile_headers(${APP_NAME} PRIVATE
431+ "$<$<COMPILE_LANGUAGE:CXX>:precheader.h>" )
432+ endif ()
You can’t perform that action at this time.
0 commit comments