summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml4
-rw-r--r--src/CMakeLists.txt12
2 files changed, 13 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml
index ec9e4b12..e5536fc1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -57,8 +57,8 @@ addons:
- mpfr
before_script:
- # On macOS, precompiling system.hh does not work, and boost-python packaging is broken
- - if [ "$TRAVIS_OS_NAME" = osx ]; then EXTRA_CMAKE_ARGS="-DPRECOMPILE_SYSTEM_HH=OFF -DBoost_NO_BOOST_CMAKE=ON"; fi
+ # On macOS boost-python packaging is broken
+ - if [ "$TRAVIS_OS_NAME" = osx ]; then EXTRA_CMAKE_ARGS="-DBoost_NO_BOOST_CMAKE=ON"; fi
- cmake . -DUSE_PYTHON=ON -DPython_FIND_VERSION_MAJOR=${PY_MAJOR} -DBUILD_DEBUG=ON $EXTRA_CMAKE_ARGS
- make VERBOSE=1
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5eddd5ac..167f5515 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -265,7 +265,8 @@ else()
endmacro(ADD_PCH_RULE _header_filename _src_list _other_srcs)
endif()
-if(PRECOMPILE_SYSTEM_HH)
+if(PRECOMPILE_SYSTEM_HH AND NOT (COMMAND target_precompile_headers))
+ # enable fallback for CMake versions older than 3.16 without target_precompile_headers
add_pch_rule(${PROJECT_BINARY_DIR}/system.hh LEDGER_SOURCES LEDGER_CLI_SOURCES)
endif()
@@ -294,6 +295,15 @@ else()
add_ledger_library_dependencies(ledger)
endif()
+if (PRECOMPILE_SYSTEM_HH AND (COMMAND target_precompile_headers) AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
+ if (BUILD_LIBRARY)
+ target_precompile_headers(libledger PRIVATE ${PROJECT_BINARY_DIR}/system.hh)
+ target_precompile_headers(ledger REUSE_FROM libledger)
+ else()
+ target_precompile_headers(ledger PRIVATE ${PROJECT_BINARY_DIR}/system.hh)
+ endif()
+endif()
+
if (USE_PYTHON)
if (Python_SITEARCH)
if (WIN32 AND NOT CYGWIN)