summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/File_Generate/GenerateSource.cmake
blob: d5504e330abe5817b22e02b9aac20bd331f44960 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

enable_language(CXX)

# Ensure re-generation
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")

file(GENERATE
  OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
  CONTENT "int main() { return 0; }\n"
)

add_executable(mn "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")

add_subdirectory(GenerateSource)
target_link_libraries(mn PRIVATE ObjLib)