-
-
Notifications
You must be signed in to change notification settings - Fork 451
use CPM.cmake module to fetch project_options #207
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| cmake_minimum_required(VERSION 3.16) | ||
| cmake_minimum_required(VERSION 3.16...3.23) | ||
|
|
||
| # Not ideal to use this global variable, but necessary to make sure | ||
| # that tooling and projects use the same version | ||
|
|
@@ -22,11 +22,20 @@ set(OPT_WARNINGS_AS_ERRORS_DEVELOPER_DEFAULT TRUE) | |
|
|
||
| # Add project_options v0.17.0 | ||
| # https://github.com/cpp-best-practices/project_options | ||
| include(FetchContent) | ||
| FetchContent_Declare(_project_options | ||
| URL https://github.com/cpp-best-practices/project_options/archive/refs/tags/v0.17.0.zip) | ||
| FetchContent_MakeAvailable(_project_options) | ||
| include(${_project_options_SOURCE_DIR}/Index.cmake) | ||
| # include(FetchContent) | ||
| # FetchContent_Declare(_project_options | ||
| # URL https://github.com/cpp-best-practices/project_options/archive/refs/tags/v0.17.0.zip) | ||
| # FetchContent_MakeAvailable(_project_options) | ||
| # include(${_project_options_SOURCE_DIR}/Index.cmake) | ||
|
|
||
| # ---- Add dependencies via CPM ---- | ||
| # see https://github.com/cpm-cmake/CPM.cmake for more info | ||
| include(cmake/CPM.cmake) | ||
|
|
||
| # Add project_options v0.18.0, but my version! CK | ||
| # https://github.com/cpp-best-practices/project_options | ||
| CPMAddPackage("gh:ClausKlein/cmakelib#865af7a1339c03cc8b3cab0d3dcd01ec789f456c") | ||
| list(APPEND CMAKE_MODULE_PATH ${ProjectOptions_SRC_DIR}) | ||
|
|
||
| # uncomment to enable vcpkg: | ||
| # # Setup vcpkg - should be called before defining project() | ||
|
|
@@ -71,7 +80,7 @@ if(BUILDING_MULTI_CONFIG) | |
| endif() | ||
| endif() | ||
|
|
||
| include(${_project_options_SOURCE_DIR}/src/DynamicProjectOptions.cmake) | ||
| include(DynamicProjectOptions) | ||
|
|
||
| # defaulted_project_options sets recommended defaults and provides user and developer | ||
| # modes and full GUI support for choosing options at configure time | ||
|
|
@@ -92,6 +101,7 @@ dynamic_project_options( | |
| PCH_HEADERS | ||
| <vector> | ||
| <string> # This is a list of headers to pre-compile, here are some common ones | ||
| ENABLE_CONAN | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am woundering conan was not enabled?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably an artifact of the split between cpp_boilerplate_project and cpp_starter_project. Without |
||
| # CONAN_OPTIONS # Extra options to pass to conan | ||
| # MSVC_WARNINGS # Override the defaults for the MSVC warnings | ||
| # CLANG_WARNINGS # Override the defaults for the CLANG warnings | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| set(CPM_DOWNLOAD_VERSION 0.35.0) | ||
|
|
||
| if(CPM_SOURCE_CACHE) | ||
| # Expand relative path. This is important if the provided path contains a tilde (~) | ||
| get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE) | ||
| set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
| elseif(DEFINED ENV{CPM_SOURCE_CACHE}) | ||
| set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
| else() | ||
| set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
| endif() | ||
|
|
||
| if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION})) | ||
| message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}") | ||
| file(DOWNLOAD https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake | ||
| ${CPM_DOWNLOAD_LOCATION} | ||
| ) | ||
| endif() | ||
|
|
||
| include(${CPM_DOWNLOAD_LOCATION}) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| find_package(Catch2 REQUIRED) | ||
|
|
||
| include(CTest) | ||
| #XXX include(CTest) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do you include CTest modue?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you want to enable submissions to a CDash server? |
||
| include(Catch) | ||
|
|
||
| add_library(catch_main OBJECT catch_main.cpp) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only for test now, later original may be used!