|
| 1 | +From cefe59f72f055a06cfd47578b7753e8f4b91e115 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Amin Yahyaabadi < [email protected]> |
| 3 | +Date: Tue, 6 Jun 2023 13:47:35 -0700 |
| 4 | +Subject: [PATCH 2/2] fix: fix build on MacOS when FindFileSystem fails |
| 5 | + |
| 6 | +--- |
| 7 | + cmake/FindFilesystem.cmake | 2 +- |
| 8 | + source/matplot/CMakeLists.txt | 2 +- |
| 9 | + test/generate_examples/CMakeLists.txt | 8 ++++---- |
| 10 | + 3 files changed, 6 insertions(+), 6 deletions(-) |
| 11 | + |
| 12 | +diff --git a/cmake/FindFilesystem.cmake b/cmake/FindFilesystem.cmake |
| 13 | +index ccdb3de..25d905b 100644 |
| 14 | +--- a/cmake/FindFilesystem.cmake |
| 15 | ++++ b/cmake/FindFilesystem.cmake |
| 16 | +@@ -248,5 +248,5 @@ cmake_pop_check_state() |
| 17 | + set(Filesystem_FOUND ${_found} CACHE BOOL "TRUE if we can run a program using std::filesystem" FORCE) |
| 18 | + |
| 19 | + if(Filesystem_FIND_REQUIRED AND NOT Filesystem_FOUND) |
| 20 | +- message(FATAL_ERROR "Cannot run a simple program using std::filesystem\nYou need to update your C++ compiler to use this library") |
| 21 | ++ message(STATUS "Could not run a simple program using std::filesystem\nYou might need to update your C++ compiler to use this library") |
| 22 | + endif() |
| 23 | +diff --git a/source/matplot/CMakeLists.txt b/source/matplot/CMakeLists.txt |
| 24 | +index fe9ad53..b059aa1 100644 |
| 25 | +--- a/source/matplot/CMakeLists.txt |
| 26 | ++++ b/source/matplot/CMakeLists.txt |
| 27 | +@@ -102,7 +102,7 @@ target_include_directories(matplot |
| 28 | + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) |
| 29 | + |
| 30 | + # Dependencies |
| 31 | +-if(NOT MINGW) |
| 32 | ++if(TARGET std::filesystem AND NOT MINGW) |
| 33 | + target_link_libraries_system(matplot |
| 34 | + PRIVATE cimg nodesoup std::filesystem) |
| 35 | + else() |
| 36 | +diff --git a/test/generate_examples/CMakeLists.txt b/test/generate_examples/CMakeLists.txt |
| 37 | +index 32d0145..c9f7d09 100644 |
| 38 | +--- a/test/generate_examples/CMakeLists.txt |
| 39 | ++++ b/test/generate_examples/CMakeLists.txt |
| 40 | +@@ -1,8 +1,8 @@ |
| 41 | + if(NOT MINGW) |
| 42 | +-find_package(Filesystem REQUIRED) |
| 43 | ++ find_package(Filesystem REQUIRED) |
| 44 | + endif() |
| 45 | + add_executable(generate_examples main.cpp) |
| 46 | +-if(NOT MINGW) |
| 47 | +-target_link_libraries(generate_examples std::filesystem) |
| 48 | ++if(TARGET std::filesystem) |
| 49 | ++ target_link_libraries(generate_examples std::filesystem) |
| 50 | + endif() |
| 51 | +-target_compile_features(generate_examples PRIVATE cxx_std_17) |
| 52 | +\ No newline at end of file |
| 53 | ++target_compile_features(generate_examples PRIVATE cxx_std_17) |
| 54 | +-- |
| 55 | +2.34.1 |
| 56 | + |
0 commit comments