v0.14.0
PrecompiledHeaders.cmake
Go to the documentation of this file.
1 option(NOT_PRECOMPILED_HEADRES "Do not use procompiled headers" OFF)
2 if(NOT NOT_PRECOMPILED_HEADRES)
3  if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 3.0.0)
4  if("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*[Cc]lang" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
5  set(PRECOMPILED_HEADRES ON)
6  endif("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*[Cc]lang" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
7  endif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 3.0.0)
8 endif(NOT NOT_PRECOMPILED_HEADRES)
9 
10 function(my_add_executable target source)
11  if(PRECOMPILED_HEADRES)
12  set_source_files_properties(${source} PROPERTIES COMPILE_FLAGS "-include ${PERCOMPILED_MOFEM_HEADER}")
13  endif(PRECOMPILED_HEADRES)
14  add_executable(${target} ${source})
15  if(PRECOMPILED_HEADRES)
16  add_dependencies(${target} MoFEM.hpp.pch_copy)
17  endif(PRECOMPILED_HEADRES)
18 endfunction(my_add_executable)