enable_language(CXX) add_subdirectory(ExcludeFromAll EXCLUDE_FROM_ALL) add_executable(main main.cpp) target_link_libraries(main PRIVATE foo) file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$>.cmake CONTENT " set(main_exe \"$\") set(foo_lib \"$\") set(bar_lib \"$\") set(zot_lib \"$\") set(subinc_lib \"$\") ")