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 9
9
# - CMake 3.26.5, https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/
10
10
cmake_minimum_required (VERSION 3.22 )
11
11
12
- if ( ${ CMAKE_SOURCE_DIR} STREQUAL ${ CMAKE_BINARY_DIR} )
12
+ if ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
13
13
message (FATAL_ERROR "In-source builds are not allowed." )
14
14
endif ()
15
15
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
+
16
22
#=============================
17
23
# Project / Package metadata
18
24
#=============================
Original file line number Diff line number Diff line change @@ -7,6 +7,14 @@ macro(set_add_custom_command_options)
7
7
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.27 )
8
8
set (DEPENDS_EXPLICIT_OPT DEPENDS_EXPLICIT_ONLY )
9
9
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 ()
10
18
endmacro ()
11
19
12
20
# Specifies JSON data files to be processed into corresponding
@@ -20,6 +28,7 @@ function(target_json_data_sources target)
20
28
COMMAND ${CMAKE_COMMAND} -DJSON_SOURCE_PATH=${CMAKE_CURRENT_SOURCE_DIR}/${json_file} -DHEADER_PATH=${header} -P ${PROJECT_SOURCE_DIR} /cmake/script/GenerateHeaderFromJson.cmake
21
29
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR} /${json_file} ${PROJECT_SOURCE_DIR} /cmake/script/GenerateHeaderFromJson.cmake
22
30
VERBATIM
31
+ ${CODEGEN_OPT}
23
32
${DEPENDS_EXPLICIT_OPT}
24
33
)
25
34
target_sources (${target} PRIVATE ${header} )
@@ -38,6 +47,7 @@ function(target_raw_data_sources target)
38
47
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
39
48
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR} /${raw_file} ${PROJECT_SOURCE_DIR} /cmake/script/GenerateHeaderFromRaw.cmake
40
49
VERBATIM
50
+ ${CODEGEN_OPT}
41
51
${DEPENDS_EXPLICIT_OPT}
42
52
)
43
53
target_sources (${target} PRIVATE ${header} )
You can’t perform that action at this time.
0 commit comments