File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 99# - CMake 3.26.5, https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/
1010cmake_minimum_required (VERSION 3.22)
1111
12- if ( ${ CMAKE_SOURCE_DIR} STREQUAL ${ CMAKE_BINARY_DIR} )
12+ if ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
1313 message (FATAL_ERROR "In-source builds are not allowed." )
1414endif ()
1515
16+ if (POLICY CMP0171)
17+ # `codegen` is a reserved target name.
18+ # See: https://cmake.org/cmake/help/latest/policy/CMP0171.html
19+ cmake_policy (SET CMP0171 NEW)
20+ endif ()
21+
1622#=============================
1723# Project / Package metadata
1824#=============================
Original file line number Diff line number Diff line change @@ -7,6 +7,14 @@ macro(set_add_custom_command_options)
77 if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.27)
88 set (DEPENDS_EXPLICIT_OPT DEPENDS_EXPLICIT_ONLY)
99 endif ()
10+ set (CODEGEN_OPT "" )
11+ if (POLICY CMP0171)
12+ cmake_policy (GET CMP0171 _cmp0171_status)
13+ if (_cmp0171_status STREQUAL "NEW" )
14+ set (CODEGEN_OPT CODEGEN)
15+ endif ()
16+ unset (_cmp0171_status)
17+ endif ()
1018endmacro ()
1119
1220# Specifies JSON data files to be processed into corresponding
@@ -20,6 +28,7 @@ function(target_json_data_sources target)
2028 COMMAND ${CMAKE_COMMAND} -DJSON_SOURCE_PATH=${CMAKE_CURRENT_SOURCE_DIR} /${json_file} -DHEADER_PATH=${header} -P ${PROJECT_SOURCE_DIR} /cmake/script/GenerateHeaderFromJson.cmake
2129 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR} /${json_file} ${PROJECT_SOURCE_DIR} /cmake/script/GenerateHeaderFromJson.cmake
2230 VERBATIM
31+ ${CODEGEN_OPT}
2332 ${DEPENDS_EXPLICIT_OPT}
2433 )
2534 target_sources (${target} PRIVATE ${header} )
@@ -38,6 +47,7 @@ function(target_raw_data_sources target)
3847 COMMAND ${CMAKE_COMMAND} -DRAW_SOURCE_PATH=${CMAKE_CURRENT_SOURCE_DIR} /${raw_file} -DHEADER_PATH=${header} -DRAW_NAMESPACE=${__NAMESPACE} -P ${PROJECT_SOURCE_DIR} /cmake/script/GenerateHeaderFromRaw.cmake
3948 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR} /${raw_file} ${PROJECT_SOURCE_DIR} /cmake/script/GenerateHeaderFromRaw.cmake
4049 VERBATIM
50+ ${CODEGEN_OPT}
4151 ${DEPENDS_EXPLICIT_OPT}
4252 )
4353 target_sources (${target} PRIVATE ${header} )
You can’t perform that action at this time.
0 commit comments