mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-01 03:11:08 -06:00
Previously the `TARGET_OBJECTS` generator expression was limited only to use in a buildsystem context so that Xcode's placeholders in object file paths can be evaluated. Lift this restriction so that the expression can at least be used in most settings. Co-Author: Brad King <brad.king@kitware.com>
12 lines
478 B
CMake
12 lines
478 B
CMake
enable_language(CXX)
|
|
|
|
file(GENERATE
|
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<BOOL:$<TARGET_OBJECTS:foo>>somefile.cpp"
|
|
CONTENT "static const char content[] = \"$<TARGET_OBJECTS:foo>\";\n"
|
|
)
|
|
|
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/input.txt"
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/input.txt" "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
add_executable(foo empty.cpp "${CMAKE_CURRENT_BINARY_DIR}/1somefile.cpp" "${CMAKE_CURRENT_BINARY_DIR}/input.txt")
|