| 1 |
cmake_minimum_required(VERSION 3.15...4.1) |
| 2 |
|
| 3 |
#### Check important configuration pre-requisites. |
| 4 |
# |
| 5 |
|
| 6 |
# Discourage in-source builds; they overwrite the hand-written Makefile, and generally cause confusion. |
| 7 |
# Use `cmake . -B<dir>` or the CMake GUI to do an out-of-source build. |
| 8 |
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) |
| 9 |
message(FATAL_ERROR "Out-of-source builds are recommended for this project.") |
| 10 |
endif() |
| 11 |
|
| 12 |
#### Extract version from include/libjsonnet.h so it can be put in the project version. |
| 13 |
# |
| 14 |
|
| 15 |
# Extract release version number from include/libjsonnet.h. |
| 16 |
# We do this in various other (non-CMake-build) places too, e.g., the Python wheel build. |
| 17 |
|
| 18 |
set(JSONNET_HEADER_VERSION_REGEX |
| 19 |
[=[^[ \t]*#[ \t]*define[ \t]+LIB_JSONNET_VERSION[ \t]+\"v([0-9.]+(-?[a-z][a-z0-9]*)?)\"[ \t]*$]=]) |
| 20 |
file( |
| 21 |
STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/include/libjsonnet.h JSONNET_HEADER_VERSION |
| 22 |
LIMIT_COUNT 1 |
| 23 |
REGEX ${JSONNET_HEADER_VERSION_REGEX}) |
| 24 |
string(REGEX REPLACE ${JSONNET_HEADER_VERSION_REGEX} "\\1" JSONNET_HEADER_VERSION "${JSONNET_HEADER_VERSION}") |
| 25 |
message(VERBOSE "Extracted version from include/libjsonnet.h: ${JSONNET_HEADER_VERSION}") |
| 26 |
|
| 27 |
#### Set CMake project. |
| 28 |
# |
| 29 |
|
| 30 |
project( |
| 31 |
jsonnet |
| 32 |
HOMEPAGE_URL "https://jsonnet.org/" |
| 33 |
LANGUAGES C CXX) |
| 34 |
|
| 35 |
#### Unconditional CMake module includes. |
| 36 |
# |
| 37 |
|
| 38 |
include(GNUInstallDirs) |
| 39 |
|
| 40 |
#### Set up cacheable/user-configurable state. |
| 41 |
# |
| 42 |
|
| 43 |
# User-configurable options. |
| 44 |
option(BUILD_JSONNET "Build jsonnet command-line tool." ON) |
| 45 |
option(BUILD_JSONNETFMT "Build jsonnetfmt command-line tool." ON) |
| 46 |
option(BUILD_TESTS "Build and run jsonnet tests." ON) |
| 47 |
option(BUILD_STATIC_LIBS "Build a static libjsonnet." ON) |
| 48 |
option(BUILD_SHARED_LIBS "Build shared libjsonnet." ON) |
| 49 |
option(BUILD_SHARED_BINARIES "Link binaries to the shared libjsonnet instead of the static one." OFF) |
| 50 |
option(BUILD_MAN_PAGES "Build manpages." ON) |
| 51 |
option(USE_SYSTEM_GTEST "Use system-provided gtest library" OFF) |
| 52 |
option(USE_SYSTEM_JSON "Use the system-provided json library" OFF) |
| 53 |
option(USE_SYSTEM_RAPIDYAML "Use the system-provided rapidyaml library" OFF) |
| 54 |
|
| 55 |
#### Compute derived values from user-configurable state. |
| 56 |
# |
| 57 |
|
| 58 |
# Helper variable set to ON if there is any reason we need to build the jsonnet command binaries. |
| 59 |
if(BUILD_TESTS OR BUILD_JSONNET OR BUILD_JSONNETFMT) |
| 60 |
set(BUILD_SOME_BINARIES ON) |
| 61 |
else() |
| 62 |
set(BUILD_SOME_BINARIES OFF) |
| 63 |
endif() |
| 64 |
|
| 65 |
#### System package searches. |
| 66 |
# |
| 67 |
|
| 68 |
if(USE_SYSTEM_JSON) |
| 69 |
find_package(nlohmann_json 3.6.1 REQUIRED) |
| 70 |
endif() |
| 71 |
|
| 72 |
if(USE_SYSTEM_RAPIDYAML) |
| •73 |
find_package(ryml REQUIRED) |
| 74 |
endif() |
| 75 |
|
| 76 |
#### Utility function to configure a target with our preferred C and C++ compilation flags. |
| 77 |
# |
| 78 |
|
| 79 |
function(configure_target_cc_props LIB_TARGET_NAME) |
| 80 |
set_property(TARGET ${LIB_TARGET_NAME} PROPERTY CXX_STANDARD 17) |
| 81 |
set_property(TARGET ${LIB_TARGET_NAME} PROPERTY CXX_EXTENSIONS OFF) |
| 82 |
set_property(TARGET ${LIB_TARGET_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) |
| 83 |
set_property(TARGET ${LIB_TARGET_NAME} PROPERTY C_STANDARD 99) |
| 84 |
set_property(TARGET ${LIB_TARGET_NAME} PROPERTY C_EXTENSIONS OFF) |
| 85 |
set_property(TARGET ${LIB_TARGET_NAME} PROPERTY C_STANDARD_REQUIRED ON) |
| 86 |
|
| 87 |
if (NOT MSVC) |
| 88 |
target_compile_options(${LIB_TARGET_NAME} |
| 89 |
PRIVATE |
| 90 |
-Wall -Wextra -Wimplicit-fallthrough |
| 91 |
-pedantic |
| 92 |
$<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual> |
| 93 |
) |
| 94 |
endif() |
| 95 |
endfunction() |
| 96 |
|
| 97 |
#### Sub-directory CMakeLists includes. |
| 98 |
# |
| 99 |
|
| 100 |
add_subdirectory(stdlib) |
| 101 |
|
| 102 |
#### Utility function to set up all the properties for an OBJECT library for the jsonnet core. |
| 103 |
# |
| 104 |
# This is done as a function because there separate object libraries for shared vs. static. |
| 105 |
# Shared has slightly different compilation flags (it needs -fPIC). |
| 106 |
# |
| 107 |
|
| 108 |
function(configure_jsonnet_obj_target LIB_TARGET_NAME) |
| 109 |
configure_target_cc_props(${LIB_TARGET_NAME}) |
| 110 |
target_sources(${LIB_TARGET_NAME} |
| 111 |
PRIVATE |
| 112 |
third_party/md5/md5.h |
| 113 |
third_party/md5/md5.cpp |
| 114 |
|
| 115 |
core/static_error.h |
| 116 |
core/desugarer.h |
| 117 |
core/unicode.h |
| 118 |
core/vm.h |
| 119 |
core/static_analysis.h |
| 120 |
core/path_utils.h |
| 121 |
core/state.h |
| 122 |
core/pass.h |
| 123 |
core/ast.h |
| 124 |
core/json.h |
| 125 |
core/string_utils.h |
| 126 |
core/formatter.h |
| 127 |
core/parser.h |
| 128 |
core/lexer.h |
| 129 |
|
| 130 |
core/desugarer.cpp |
| 131 |
core/formatter.cpp |
| 132 |
core/lexer.cpp |
| 133 |
core/libjsonnet.cpp |
| 134 |
core/parser.cpp |
| 135 |
core/pass.cpp |
| 136 |
core/path_utils.cpp |
| 137 |
core/static_analysis.cpp |
| 138 |
core/string_utils.cpp |
| 139 |
core/vm.cpp |
| 140 |
|
| 141 |
PUBLIC |
| 142 |
include/libjsonnet.h |
| 143 |
include/libjsonnet_fmt.h |
| 144 |
) |
| 145 |
|
| 146 |
target_link_libraries(${LIB_TARGET_NAME} PRIVATE stdlib_h) |
| 147 |
|
| 148 |
if(USE_SYSTEM_JSON) |
| 149 |
target_link_libraries(${LIB_TARGET_NAME} PRIVATE nlohmann_json::nlohmann_json) |
| 150 |
else() |
| 151 |
target_sources(${LIB_TARGET_NAME} |
| 152 |
PRIVATE |
| 153 |
third_party/json/nlohmann/json.hpp |
| 154 |
) |
| 155 |
target_include_directories(${LIB_TARGET_NAME} |
| 156 |
SYSTEM PRIVATE third_party/json) |
| 157 |
endif() |
| 158 |
|
| 159 |
if(USE_SYSTEM_RAPIDYAML) |
| 160 |
target_link_libraries(${LIB_TARGET_NAME} PRIVATE ryml::ryml) |
| 161 |
target_compile_definitions(${LIB_TARGET_NAME} PRIVATE USE_SYSTEM_RAPIDYAML) |
| •162 |
if(ryml_VERSION VERSION_GREATER_EQUAL "0.11.0") |
| 163 |
target_compile_definitions(${LIB_TARGET_NAME} PRIVATE RYML_NEW_ERROR_API) |
| 164 |
endif() |
| 165 |
else() |
| 166 |
target_sources(${LIB_TARGET_NAME} |
| 167 |
PRIVATE |
| 168 |
third_party/rapidyaml/rapidyaml-0.10.0.hpp |
| 169 |
third_party/rapidyaml/rapidyaml.cpp |
| 170 |
) |
| 171 |
endif() |
| 172 |
|
| 173 |
target_include_directories(${LIB_TARGET_NAME} |
| 174 |
PUBLIC |
| 175 |
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 176 |
$<INSTALL_INTERFACE:include> |
| 177 |
PRIVATE |
| 178 |
third_party/md5 |
| 179 |
$<$<NOT:$<BOOL:${USE_SYSTEM_RAPIDYAML}>>:${CMAKE_CURRENT_SOURCE_DIR}/third_party/rapidyaml> |
| 180 |
) |
| 181 |
endfunction() |
| 182 |
|
| 183 |
#### Utility function to set up library target properties for the C lib. |
| 184 |
# |
| 185 |
|
| 186 |
function(configure_jsonnet_lib_target LIB_TARGET_NAME OBJ_TARGET_NAME) |
| 187 |
configure_target_cc_props(${LIB_TARGET_NAME}) |
| 188 |
target_link_libraries(${LIB_TARGET_NAME} PUBLIC ${OBJ_TARGET_NAME}) |
| 189 |
set(JSONNET_PUBLIC_HEADERS include/libjsonnet.h include/libjsonnet_fmt.h) |
| 190 |
set_target_properties(${LIB_TARGET_NAME} PROPERTIES |
| 191 |
OUTPUT_NAME jsonnet |
| 192 |
PUBLIC_HEADER "${JSONNET_PUBLIC_HEADERS}") |
| 193 |
endfunction() |
| 194 |
|
| 195 |
#### Utility function to set up library target properties for the C++ lib. |
| 196 |
# |
| 197 |
|
| 198 |
function(configure_jsonnet_cpp_lib_target LIB_TARGET_NAME OBJ_TARGET_NAME) |
| 199 |
configure_target_cc_props(${LIB_TARGET_NAME}) |
| 200 |
target_sources(${LIB_TARGET_NAME} |
| 201 |
PRIVATE |
| 202 |
cpp/libjsonnet++.cpp |
| 203 |
include/libjsonnet++.h |
| 204 |
) |
| 205 |
target_link_libraries(${LIB_TARGET_NAME} PUBLIC ${OBJ_TARGET_NAME}) |
| 206 |
set(JSONNET_PUBLIC_HEADERS include/libjsonnet.h include/libjsonnet++.h) |
| 207 |
set_target_properties(${LIB_TARGET_NAME} PROPERTIES |
| 208 |
OUTPUT_NAME jsonnet++ |
| 209 |
PUBLIC_HEADER "${JSONNET_PUBLIC_HEADERS}") |
| 210 |
endfunction() |
| 211 |
|
| 212 |
#### Static library target setup. |
| 213 |
# |
| 214 |
|
| 215 |
if(BUILD_STATIC_LIBS OR (BUILD_SOME_BINARIES AND NOT BUILD_SHARED_BINARIES)) |
| 216 |
add_library(jsonnet_obj_static OBJECT) |
| 217 |
configure_jsonnet_obj_target(jsonnet_obj_static) |
| 218 |
|
| 219 |
add_library(jsonnet_static STATIC) |
| 220 |
configure_jsonnet_lib_target(jsonnet_static jsonnet_obj_static) |
| 221 |
|
| 222 |
add_library(jsonnet_cpp_static STATIC) |
| 223 |
configure_jsonnet_cpp_lib_target(jsonnet_cpp_static jsonnet_obj_static) |
| 224 |
|
| 225 |
if(BUILD_STATIC_LIBS) |
| 226 |
install(TARGETS jsonnet_static jsonnet_cpp_static) |
| 227 |
endif() |
| 228 |
endif() |
| 229 |
|
| 230 |
#### Shared library target setup. |
| 231 |
# |
| 232 |
|
| 233 |
if(BUILD_SHARED_LIBS OR (BUILD_SOME_BINARIES AND BUILD_SHARED_BINARIES)) |
| 234 |
add_library(jsonnet_obj_shared OBJECT) |
| 235 |
set_property(TARGET jsonnet_obj_shared PROPERTY POSITION_INDEPENDENT_CODE ON) |
| 236 |
configure_jsonnet_obj_target(jsonnet_obj_shared) |
| 237 |
|
| 238 |
add_library(jsonnet_shared SHARED) |
| 239 |
configure_jsonnet_lib_target(jsonnet_shared jsonnet_obj_shared) |
| 240 |
set_target_properties(jsonnet_shared PROPERTIES |
| 241 |
VERSION "${JSONNET_HEADER_VERSION}" |
| 242 |
SOVERSION "0") |
| 243 |
|
| 244 |
add_library(jsonnet_cpp_shared SHARED) |
| 245 |
configure_jsonnet_cpp_lib_target(jsonnet_cpp_shared jsonnet_obj_shared) |
| 246 |
set_target_properties(jsonnet_cpp_shared PROPERTIES |
| 247 |
VERSION "${JSONNET_HEADER_VERSION}" |
| 248 |
SOVERSION "0") |
| 249 |
|
| 250 |
if(BUILD_SHARED_LIBS) |
| 251 |
install(TARGETS jsonnet_shared jsonnet_cpp_shared) |
| 252 |
endif() |
| 253 |
endif() |
| 254 |
|
| 255 |
#### Alias the library to use for binaries. |
| 256 |
# |
| 257 |
|
| 258 |
if(BUILD_SHARED_BINARIES) |
| 259 |
add_library(jsonnet_lib_for_binaries ALIAS jsonnet_shared) |
| 260 |
add_library(jsonnet_cpp_lib_for_binaries ALIAS jsonnet_cpp_shared) |
| 261 |
else() |
| 262 |
add_library(jsonnet_lib_for_binaries ALIAS jsonnet_static) |
| 263 |
add_library(jsonnet_cpp_lib_for_binaries ALIAS jsonnet_cpp_static) |
| 264 |
endif() |
| 265 |
|
| 266 |
#### An object library for the utils.cpp code which is shared by both CLI binaries. |
| 267 |
# |
| 268 |
|
| 269 |
if(BUILD_SOME_BINARIES) |
| 270 |
add_library(jsonnet_cmd_utils OBJECT |
| 271 |
cmd/utils.cpp |
| 272 |
cmd/utils.h |
| 273 |
) |
| 274 |
endif() |
| 275 |
|
| 276 |
#### CLI (jsonnet and jsonnetfmt) binary targets. |
| 277 |
# |
| 278 |
|
| 279 |
if(BUILD_JSONNET OR BUILD_TESTS) |
| 280 |
add_executable(jsonnet |
| 281 |
cmd/jsonnet.cpp |
| 282 |
$<TARGET_OBJECTS:jsonnet_cmd_utils> |
| 283 |
) |
| 284 |
target_link_libraries(jsonnet PRIVATE jsonnet_lib_for_binaries) |
| 285 |
if(BUILD_JSONNET) |
| 286 |
install(TARGETS jsonnet) |
| 287 |
endif() |
| 288 |
endif() |
| 289 |
|
| 290 |
if(BUILD_JSONNETFMT OR BUILD_TESTS) |
| 291 |
add_executable(jsonnetfmt |
| 292 |
cmd/jsonnetfmt.cpp |
| 293 |
$<TARGET_OBJECTS:jsonnet_cmd_utils> |
| 294 |
) |
| 295 |
target_link_libraries(jsonnetfmt PRIVATE jsonnet_lib_for_binaries) |
| 296 |
if(BUILD_JSONNETFMT) |
| 297 |
install(TARGETS jsonnetfmt) |
| 298 |
endif() |
| 299 |
endif() |
| 300 |
|
| 301 |
#### GoogleTest based tests. |
| 302 |
# |
| 303 |
|
| 304 |
if(BUILD_TESTS) |
| 305 |
enable_testing() |
| 306 |
include(GoogleTest) |
| 307 |
|
| 308 |
if(USE_SYSTEM_GTEST) |
| 309 |
find_package(GTest REQUIRED) |
| 310 |
else() |
| 311 |
include(FetchContent) |
| 312 |
FetchContent_Declare(googletest |
| 313 |
GIT_REPOSITORY https://github.com/google/googletest.git |
| 314 |
GIT_TAG v1.17.0 |
| 315 |
) |
| 316 |
# For Windows: Prevent overriding the parent project's compiler/linker settings. |
| 317 |
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) |
| 318 |
# Prevent including GoogleTest in the generated install rules. |
| 319 |
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) |
| 320 |
FetchContent_MakeAvailable(googletest) |
| 321 |
endif() |
| 322 |
|
| 323 |
set(JSONNET_TEST_TARGETS) |
| 324 |
|
| 325 |
function(jsonnet_add_gtest TESTNAME JSONNET_LIB_TARGET) |
| 326 |
set(JSONNET_TEST_TARGETS ${JSONNET_TEST_TARGETS} ${TESTNAME} PARENT_SCOPE) |
| 327 |
add_executable(${TESTNAME} ${ARGN}) |
| 328 |
target_link_libraries(${TESTNAME} ${JSONNET_LIB_TARGET} gtest gmock gtest_main) |
| 329 |
gtest_discover_tests(${TESTNAME} |
| 330 |
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} |
| 331 |
PROPERTIES |
| 332 |
VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" |
| 333 |
ENVIRONMENT "JSONNET_SOURCE_BASE=${PROJECT_SOURCE_DIR}" |
| 334 |
) |
| 335 |
set_target_properties(${TESTNAME} PROPERTIES FOLDER tests) |
| 336 |
endfunction() |
| 337 |
|
| 338 |
function(jsonnet_add_raw_test TESTNAME JSONNET_LIB_TARGET) |
| 339 |
set(JSONNET_TEST_TARGETS ${JSONNET_TEST_TARGETS} ${TESTNAME} PARENT_SCOPE) |
| 340 |
add_executable(${TESTNAME} ${ARGN}) |
| 341 |
target_link_libraries(${TESTNAME} ${JSONNET_LIB_TARGET}) |
| 342 |
set_target_properties(${TESTNAME} PROPERTIES FOLDER tests) |
| 343 |
add_test(NAME ${TESTNAME} COMMAND ${TESTNAME}) |
| 344 |
endfunction() |
| 345 |
|
| 346 |
jsonnet_add_gtest(test_core_unicode jsonnet_lib_for_binaries core/unicode_test.cpp) |
| 347 |
jsonnet_add_gtest(test_core_lexer jsonnet_lib_for_binaries core/lexer_test.cpp) |
| 348 |
jsonnet_add_gtest(test_core_parser jsonnet_lib_for_binaries core/parser_test.cpp) |
| 349 |
jsonnet_add_gtest(test_core_libjsonnet jsonnet_lib_for_binaries core/libjsonnet_test.cpp) |
| 350 |
jsonnet_add_gtest(test_cpp_libjsonnet jsonnet_cpp_lib_for_binaries cpp/libjsonnet++_test.cpp) |
| 351 |
jsonnet_add_gtest(test_cpp_libjsonnet_locale jsonnet_cpp_lib_for_binaries cpp/libjsonnet_locale_test.cpp) |
| 352 |
|
| 353 |
jsonnet_add_raw_test(test_core_libjsonnet_native_callbacks jsonnet_lib_for_binaries core/libjsonnet_native_callbacks_test.c) |
| 354 |
|
| 355 |
# core/libjsonnet_file_test needs an input file |
| 356 |
add_executable(test_libjsonnet_file core/libjsonnet_file_test.c) |
| 357 |
target_link_libraries(test_libjsonnet_file jsonnet_lib_for_binaries) |
| 358 |
set_target_properties(test_libjsonnet_file PROPERTIES FOLDER tests) |
| 359 |
add_test( |
| 360 |
NAME test_libjsonnet_file |
| 361 |
COMMAND test_libjsonnet_file "test_suite/object.jsonnet" |
| 362 |
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" |
| 363 |
) |
| 364 |
|
| 365 |
add_subdirectory(test_suite) |
| 366 |
|
| 367 |
# `run_tests` target builds and runs all tests |
| 368 |
add_custom_target(run_tests COMMAND ${CMAKE_CTEST_COMMAND} |
| 369 |
DEPENDS |
| 370 |
jsonnet jsonnetfmt test_libjsonnet_file ${JSONNET_TEST_TARGETS} |
| 371 |
) |
| 372 |
endif() # if(BUILD_TESTS) |
| 373 |
|
| 374 |
#### Man pages |
| 375 |
# |
| 376 |
|
| 377 |
if(BUILD_MAN_PAGES AND (BUILD_JSONNET OR BUILD_JSONNETFMT)) |
| 378 |
find_program(HELP2MAN_BINARY NAMES help2man) |
| 379 |
if (HELP2MAN_BINARY) |
| 380 |
message(STATUS "help2man found, man pages will be generated.") |
| 381 |
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/man/man1") |
| 382 |
if(BUILD_JSONNET) |
| 383 |
add_custom_command( |
| 384 |
OUTPUT "${PROJECT_BINARY_DIR}/man/man1/jsonnet.1" |
| 385 |
COMMAND "${HELP2MAN_BINARY}" |
| 386 |
ARGS --section=1 --no-info --name="Jsonnet data templating language interpreter" --output="${PROJECT_BINARY_DIR}/man/man1/jsonnet.1" "$<TARGET_FILE:jsonnet>" |
| 387 |
DEPENDS jsonnet |
| 388 |
) |
| 389 |
endif() |
| 390 |
if(BUILD_JSONNETFMT) |
| 391 |
add_custom_command( |
| 392 |
OUTPUT "${PROJECT_BINARY_DIR}/man/man1/jsonnetfmt.1" |
| 393 |
COMMAND "${HELP2MAN_BINARY}" |
| 394 |
ARGS --section=1 --no-info --name="Jsonnet data templating language auto-formatter" --output="${PROJECT_BINARY_DIR}/man/man1/jsonnetfmt.1" "$<TARGET_FILE:jsonnetfmt>" |
| 395 |
DEPENDS jsonnetfmt |
| 396 |
) |
| 397 |
endif() |
| 398 |
|
| 399 |
add_custom_target(jsonnet-man ALL DEPENDS "${PROJECT_BINARY_DIR}/man/man1/jsonnet.1") |
| 400 |
add_custom_target(jsonnetfmt-man ALL DEPENDS "${PROJECT_BINARY_DIR}/man/man1/jsonnetfmt.1") |
| 401 |
|
| 402 |
install(FILES ${PROJECT_BINARY_DIR}/man/man1/jsonnet.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") |
| 403 |
install(FILES ${PROJECT_BINARY_DIR}/man/man1/jsonnetfmt.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") |
| 404 |
else() |
| 405 |
message(STATUS "help2man not found, man pages will not be generated.") |
| 406 |
endif() |
| 407 |
endif() # if(BUILD_MAN_PAGES) |
| 408 |
|
| 409 |
#### CMake debugging outputs |
| 410 |
# |
| 411 |
|
| 412 |
# Note cmake_language GET_MESSAGE_LOG_LEVEL exists only in 3.25 and above. |
| 413 |
if(CMAKE_VERSION VERSION_GREATER "3.25") |
| 414 |
include(CMakePrintHelpers) |
| 415 |
cmake_language(GET_MESSAGE_LOG_LEVEL CURRENT_CMAKE_LOG_LEVEL) |
| 416 |
if(CURRENT_CMAKE_LOG_LEVEL MATCHES "TRACE") |
| 417 |
# Print specific properties for specific targets |
| 418 |
cmake_print_properties( |
| 419 |
TARGETS |
| 420 |
to_c_array |
| 421 |
stdlib_h |
| 422 |
jsonnet_obj_static |
| 423 |
jsonnet_obj_shared |
| 424 |
jsonnet_static |
| 425 |
jsonnet_shared |
| 426 |
jsonnet_cpp_static |
| 427 |
jsonnet_cpp_shared |
| 428 |
jsonnet_cmd_utils |
| 429 |
jsonnet |
| 430 |
jsonnetfmt |
| 431 |
jsonnet-man |
| 432 |
jsonnetfmt-man |
| 433 |
PROPERTIES |
| 434 |
TYPE |
| 435 |
C_STANDARD |
| 436 |
CXX_STANDARD |
| 437 |
POSITION_INDEPENDENT_CODE |
| 438 |
PUBLIC_LINK_DEPENDS |
| 439 |
INTERFACE_LINK_DEPENDS |
| 440 |
PUBLIC_LINK_LIBRARIES |
| 441 |
INTERFACE_LINK_LIBRARIES |
| 442 |
PUBLIC_INCLUDE_DIRECTORIES |
| 443 |
INTERFACE_INCLUDE_DIRECTORIES |
| 444 |
OUTPUT_NAME |
| 445 |
PUBLIC_HEADER |
| 446 |
RUNTIME_OUTPUT_DIRECTORY |
| 447 |
) |
| 448 |
endif() |
| 449 |
endif() |