Files
CMake/Tests/RunCMake/InterfaceLibrary/genex_link.cmake
Brad King 1edf138506 Tests/RunCMake: Update cmake_minimum_required versions
For policy-specific tests, use the version before the policy was
introduced.  Otherwise, use 3.5 where possible.

Also, remove `cmake_minimum_required()` and `project()` calls from
individual cases where they are handled by `CMakeLists.txt`.
2023-02-11 06:24:22 -05:00

20 lines
589 B
CMake

enable_language(CXX)
set(_main_cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp)
file(WRITE ${_main_cpp}
"int main(int argc, char** argv) { return 0; }\n"
)
add_library(foo::bar INTERFACE IMPORTED)
set_target_properties(foo::bar
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}"
# When not using a generator expression here, no error is generated
INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:foo_bar.lib>"
)
add_executable(main ${_main_cpp})
target_include_directories(main PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(main foo::bar)