diff --git a/CMakeLists.txt b/CMakeLists.txt index b54f0e15..65189b5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ ### Matplot++ ### ####################################################### # Project information -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.10) project(matplotplusplus VERSION 1.0.1) set(CMAKE_CXX_STANDARD 17) @@ -14,7 +14,9 @@ include(GNUInstallDirs) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) message("CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}") option(CPM_USE_LOCAL_PACKAGES "Try `find_package` before downloading dependencies" ON) -include(cmake/CPM.cmake) +if (NOT ${CMAKE_VERSION} VERSION_LESS "3.14.0") + include(cmake/CPM.cmake) +endif () # Check if this is a master project or a subdirectory of another project if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) @@ -119,4 +121,4 @@ if (BUILD_INSTALLER AND BUILD_PACKAGE) # Always include CPack at last include(CPack) -endif () \ No newline at end of file +endif () diff --git a/matplot++-config.cmake.in b/matplot++-config.cmake.in index 5f0a7ed5..061bdc5c 100644 --- a/matplot++-config.cmake.in +++ b/matplot++-config.cmake.in @@ -6,9 +6,9 @@ if(NOT ${MATPLOT_BUILT_SHARED}) list(APPEND CMAKE_MODULE_PATH ${MATPLOT_CONFIG_INSTALL_DIR}) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") - find_dependency(Filesystem) - list(POP_BACK CMAKE_MODULE_PATH) + find_dependency(Filesystem COMPONENTS Final Experimental) + list(REMOVE_ITEM CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") endif() include("${CMAKE_CURRENT_LIST_DIR}/Matplot++Targets.cmake") -check_required_components(Matplot++) \ No newline at end of file +check_required_components(Matplot++) diff --git a/source/matplot/CMakeLists.txt b/source/matplot/CMakeLists.txt index 8c376ebd..0d6b372f 100644 --- a/source/matplot/CMakeLists.txt +++ b/source/matplot/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(Filesystem REQUIRED) +find_package(Filesystem COMPONENTS Final Experimental REQUIRED) add_library(matplot matplot.h @@ -241,4 +241,4 @@ if (BUILD_INSTALLER) NAMESPACE Matplot++:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Matplot++ ) -endif() \ No newline at end of file +endif() diff --git a/test/generate_examples/CMakeLists.txt b/test/generate_examples/CMakeLists.txt index 60ee072d..caf8a47c 100644 --- a/test/generate_examples/CMakeLists.txt +++ b/test/generate_examples/CMakeLists.txt @@ -1,4 +1,6 @@ -find_package(Filesystem REQUIRED) -add_executable(generate_examples main.cpp) -target_link_libraries(generate_examples std::filesystem) -target_compile_features(generate_examples PRIVATE cxx_std_17) \ No newline at end of file +find_package(Filesystem COMPONENTS Final Experimental REQUIRED) +if (NOT CXX_FILESYSTEM_IS_EXPERIMENTAL) + add_executable(generate_examples main.cpp) + target_link_libraries(generate_examples std::filesystem) + target_compile_features(generate_examples PRIVATE cxx_std_17) +endif()