Files
CMake/Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake
Robert Maynard 93c89bc75c Genex: Allow TARGET_OBJECTS to be used everywhere
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>
2017-04-18 11:36:09 -04:00

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")