|
|
@@ -79,28 +79,31 @@ if(NOT APPLE_IOS AND NOT ANDROID)
|
|
|
option(ENABLE_MONOLITHIC_INSTALL "Install everything in single directory on Linux and Mac" OFF)
|
|
|
endif()
|
|
|
|
|
|
-# On Linux, use -DCMAKE_CXX_COMPILER_LAUNCHER=ccache instead.
|
|
|
-# The XCode and MSVC builds each require some more configuration, which is enabled by the following option:
|
|
|
-if(MSVC OR (CMAKE_GENERATOR STREQUAL "Xcode"))
|
|
|
- option(ENABLE_CCACHE "Speed up recompilation by caching previous compilations" OFF)
|
|
|
+option(ENABLE_CCACHE "Speed up recompilation by caching previous compilations" OFF)
|
|
|
+if(ENABLE_CCACHE)
|
|
|
+ find_program(CCACHE ccache REQUIRED)
|
|
|
+endif()
|
|
|
+
|
|
|
+# On Linux, use ccache via CMAKE_CXX_COMPILER_LAUNCHER.
|
|
|
+# The XCode and MSVC builds each require some more configuration further down.
|
|
|
+if(ENABLE_CCACHE AND LINUX)
|
|
|
+ set(CMAKE_C_COMPILER_LAUNCHER "ccache")
|
|
|
+ set(CMAKE_CXX_COMPILER_LAUNCHER "ccache")
|
|
|
endif()
|
|
|
|
|
|
if(ENABLE_CCACHE AND (CMAKE_GENERATOR STREQUAL "Xcode"))
|
|
|
- find_program(CCACHE ccache REQUIRED)
|
|
|
- if(CCACHE)
|
|
|
- # https://stackoverflow.com/a/36515503/2278742
|
|
|
- # Set up wrapper scripts
|
|
|
- configure_file(xcode/launch-c.in xcode/launch-c)
|
|
|
- configure_file(xcode/launch-cxx.in xcode/launch-cxx)
|
|
|
- execute_process(COMMAND chmod a+rx
|
|
|
- "${CMAKE_BINARY_DIR}/xcode/launch-c"
|
|
|
- "${CMAKE_BINARY_DIR}/xcode/launch-cxx")
|
|
|
- # Set Xcode project attributes to route compilation through our scripts
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/xcode/launch-c")
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/xcode/launch-cxx")
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/xcode/launch-c")
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/xcode/launch-cxx")
|
|
|
- endif()
|
|
|
+ # https://stackoverflow.com/a/36515503/2278742
|
|
|
+ # Set up wrapper scripts
|
|
|
+ configure_file(xcode/launch-c.in xcode/launch-c)
|
|
|
+ configure_file(xcode/launch-cxx.in xcode/launch-cxx)
|
|
|
+ execute_process(COMMAND chmod a+rx
|
|
|
+ "${CMAKE_BINARY_DIR}/xcode/launch-c"
|
|
|
+ "${CMAKE_BINARY_DIR}/xcode/launch-cxx")
|
|
|
+ # Set Xcode project attributes to route compilation through our scripts
|
|
|
+ set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/xcode/launch-c")
|
|
|
+ set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/xcode/launch-cxx")
|
|
|
+ set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/xcode/launch-c")
|
|
|
+ set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/xcode/launch-cxx")
|
|
|
endif()
|
|
|
|
|
|
# Allow to pass package name from Travis CI
|
|
|
@@ -266,19 +269,16 @@ if(MINGW OR MSVC)
|
|
|
if(MSVC)
|
|
|
if(ENABLE_CCACHE)
|
|
|
# https://github.com/ccache/ccache/discussions/1154#discussioncomment-3611387
|
|
|
- find_program(CCACHE ccache REQUIRED)
|
|
|
- if (CCACHE)
|
|
|
- file(COPY_FILE
|
|
|
- ${CCACHE} ${CMAKE_BINARY_DIR}/cl.exe
|
|
|
- ONLY_IF_DIFFERENT)
|
|
|
-
|
|
|
- set(CMAKE_VS_GLOBALS
|
|
|
- "CLToolExe=cl.exe"
|
|
|
- "CLToolPath=${CMAKE_BINARY_DIR}"
|
|
|
- "TrackFileAccess=false"
|
|
|
- "UseMultiToolTask=true"
|
|
|
- )
|
|
|
- endif()
|
|
|
+ file(COPY_FILE
|
|
|
+ ${CCACHE} ${CMAKE_BINARY_DIR}/cl.exe
|
|
|
+ ONLY_IF_DIFFERENT)
|
|
|
+
|
|
|
+ set(CMAKE_VS_GLOBALS
|
|
|
+ "CLToolExe=cl.exe"
|
|
|
+ "CLToolPath=${CMAKE_BINARY_DIR}"
|
|
|
+ "TrackFileAccess=false"
|
|
|
+ "UseMultiToolTask=true"
|
|
|
+ )
|
|
|
endif()
|
|
|
|
|
|
add_definitions(-DBOOST_ALL_NO_LIB)
|