#5459 Build System : Add optional support for precompiled headers

This commit is contained in:
Magne Sjaastad
2020-02-03 22:17:46 +01:00
parent a85745cb91
commit 6db2da7561
2 changed files with 48 additions and 1 deletions

View File

@@ -7,7 +7,6 @@ if(RESINSIGHT_ENABLE_UNITY_BUILD)
set(CMAKE_UNITY_BUILD true)
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-deprecated-declarations")
endif()
@@ -387,6 +386,16 @@ endif(RESINSIGHT_ENABLE_GRPC)
add_executable( ResInsight ${EXE_FILES})
option(RESINSIGHT_ENABLE_PRECOMPILED_HEADERS "Use Precompiled Headers" OFF)
mark_as_advanced(FORCE RESINSIGHT_ENABLE_PRECOMPILED_HEADERS)
if(RESINSIGHT_ENABLE_PRECOMPILED_HEADERS)
message("Precompiled Headers is enabled on : ${PROJECT_NAME}")
target_precompile_headers(ResInsight PRIVATE pch.h)
set_source_files_properties(${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
endif()
if (MSVC)
# The following warnings are supposed to be used in ResInsight, but temporarily disabled to avoid too much noise
# warning C4245: 'return': conversion from 'int' to 'size_t', signed/unsigned mismatch