-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
executable file
·32 lines (31 loc) · 1.2 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
cmake_minimum_required(VERSION 3.15.7)
if (NOT DEFINED CMAKE_CXX_STANDARD) # Only set the cxx_standard if it is not set by someone else
set(CMAKE_CXX_STANDARD 20)
endif ()
project(
confu_json
VERSION 0.0.1
LANGUAGES CXX C)
include(cmake/PreventInSourceBuilds.cmake)
include(ProjectOptions.cmake)
myproject_setup_options()
myproject_local_options()
target_compile_features(myproject_options INTERFACE cxx_std_${CMAKE_CXX_STANDARD})
add_library(myproject::myproject_options ALIAS myproject_options)
add_library(myproject::myproject_warnings ALIAS myproject_warnings)
add_subdirectory(confu_json)
OPTION(BUILD_TESTS "enable tests" OFF)
IF (BUILD_TESTS)
enable_testing()
add_subdirectory(test)
ENDIF (BUILD_TESTS)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_custom_target(copy_compile_commands_json ALL
DEPENDS ${CMAKE_SOURCE_DIR}/compile_commands.json)
add_custom_command(
OUTPUT ${CMAKE_SOURCE_DIR}/compile_commands.json
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/compile_commands.json
${CMAKE_SOURCE_DIR}/compile_commands.json
COMMENT
"copy compile_commands.json build to compile_commands.json project root so tools can find it more easily"
)