CMake/Tests/RunCMake/File_Generate/GenerateSource.cmake

13 lines
261 B
CMake

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