diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2020-03-22 05:12:39 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2020-03-22 05:12:39 +0300 |
commit | 5b60a4311ed5fadf6eba47cbf63dff5501c99b58 (patch) | |
tree | 7b14a3fbdede7f210077893df3633970a0f56e31 /CMakeLists.txt | |
parent | bad6843dde5c729f4027cf12f8f548790ba0fdf6 (diff) |
travis
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cd6eeca6..c2899441 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,9 +175,16 @@ all_link_libraries(PUBLIC quickcpplib::hl outcome::hl Threads::Threads $<$<PLATF # Set the system dependencies this library has include(CheckCXXSourceCompiles) include(CheckCXXSourceRuns) +macro(check_cxx_source_linkage prog var) + if(CMAKE_SYSTEM_PROCESSOR STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}) + check_cxx_source_runs("${prog}" ${var}) + else() + check_cxx_source_compiles("${prog}" ${var}) + endif() +endmacro() # Do we have native <filesystem> that just works without any extra effort? # We have to check if it runs, as binaries may link, but fail to run due to missing symbols -check_cxx_source_runs(" +check_cxx_source_linkage(" #include <filesystem> int main() { try { return std::filesystem::path(\"hi\").empty(); } catch(std::filesystem::filesystem_error) { return 1; } @@ -243,13 +250,13 @@ int main() { function(check_stl_filesystem_link_flags) indented_message(STATUS "NOTE: Using STL link flags '${ARGN}'") set(CMAKE_REQUIRED_LIBRARIES ${ARGN}) - check_cxx_source_runs(" + check_cxx_source_linkage(" #include <filesystem> int main() { try { return std::filesystem::path(\"hi\").empty(); } catch(std::filesystem::filesystem_error) { return 1; } } " CXX_HAS_CXX_FILESYSTEM_AFTER_FLAGS) - check_cxx_source_runs(" + check_cxx_source_linkage(" #include <experimental/filesystem> int main() { try { return std::experimental::filesystem::path(\"hi\").empty(); } catch(std::experimental::filesystem::filesystem_error) { return 1; } |