Skip to content

Commit

Permalink
Add example to test import std with cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
ClausKlein committed Dec 31, 2024
1 parent 13a79de commit f5cecba
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ project(fmt

include(cmake/variables.cmake)

include(cmake/example.cmake)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
Expand Down
5 changes: 2 additions & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"warnings": {
"dev": true,
"deprecated": true,
"uninitialized": true,
"uninitialized": false,
"unusedCli": true,
"systemVars": false
},
Expand Down Expand Up @@ -40,7 +40,7 @@
"name": "clang-tidy",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_CLANG_TIDY": "clang-tidy-18;--header-filter=^${sourceDir}/"
"CMAKE_CXX_CLANG_TIDY": "clang-tidy-19;--header-filter=^${sourceDir}/"
}
},
{
Expand Down Expand Up @@ -159,7 +159,6 @@
"binaryDir": "${sourceDir}/build/sanitize",
"inherits": [
"gen-Linux",
"clang-tidy",
"dev-mode"
],
"cacheVariables": {
Expand Down
21 changes: 21 additions & 0 deletions cmake/example.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
include(ExternalProject)

ExternalProject_Add(
example
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/example
#--Download step--------------
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/example
#--Update/Patch step----------
#--Configure step-------------
USES_TERMINAL_CONFIGURE TRUE
CONFIGURE_COMMAND cmake -G "${CMAKE_GENERATOR}" -S ${CMAKE_CURRENT_SOURCE_DIR}/example -B . -D CMAKE_BUILD_TYPE=$<CONFIG>
#--Build step-----------------
USES_TERMINAL_BUILD TRUE
# BUILD_IN_SOURCE 1
BUILD_COMMAND cmake --build . -j 8
#--Install step---------------
USES_TERMINAL_INSTALL TRUE
INSTALL_COMMAND ctest --verbose
#--Logging -------------------
LOG_BUILD ON
)

0 comments on commit f5cecba

Please sign in to comment.