File: AddCustomTargetCheckProperty.cmake

package info (click to toggle)
cmake 4.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 152,336 kB
  • sloc: ansic: 403,896; cpp: 303,920; sh: 4,105; python: 3,583; yacc: 3,106; lex: 1,279; f90: 538; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 239; objc: 215; perl: 213; xml: 198; makefile: 111; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (16 lines) | stat: -rw-r--r-- 716 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
add_custom_target(target1 ALL)
target_sources(target1 PRIVATE main.cpp)
get_property(actualProp1 TARGET target1 PROPERTY SOURCES)
set(desiredProp1 main.cpp)
if(NOT desiredProp1 STREQUAL actualProp1)
  message("source property not set. desired: \"${desiredProp1}\" actual: \"${actualProp1}\"")
endif()

add_custom_target(target2 ALL SOURCES main.cpp)
target_sources(target2 PRIVATE empty_1.cpp empty_2.cpp)
target_sources(target2 PRIVATE empty_3.cpp)
get_property(actualProp2 TARGET target2 PROPERTY SOURCES)
set(desiredProp2 main.cpp empty_1.cpp empty_2.cpp empty_3.cpp)
if (NOT desiredProp2 STREQUAL actualProp2)
  message("source property not set. desired: \"${desiredProp2}\" actual: \"${actualProp2}\"")
endif()