From 6e48ec77828f50514b63c50451780f9de688aafa Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Sat, 3 Apr 2021 15:59:49 +0200 Subject: [PATCH] Generate configure_file for every cmake.toml file --- cmake/cmkr.cmake | 5 +---- src/cmkrlib/gen.cpp | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/cmkr.cmake b/cmake/cmkr.cmake index 06d2cbb..4bf9c40 100644 --- a/cmake/cmkr.cmake +++ b/cmake/cmkr.cmake @@ -2,15 +2,12 @@ include_guard() # Disable cmkr if no cmake.toml file is found if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cmake.toml) - message(STATUS "[cmkr] Not found: ${CMAKE_CURRENT_SOURCE_DIR}/cmake.toml") + message(AUTHOR_WARNING "[cmkr] Not found: ${CMAKE_CURRENT_SOURCE_DIR}/cmake.toml") macro(cmkr) endmacro() return() endif() -# Add a build-time dependency on the contents of cmake.toml to regenerate the CMakeLists.txt when modified -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake.toml ${CMAKE_CURRENT_BINARY_DIR}/cmake.toml COPYONLY) - # Helper macro to execute a process (COMMAND_ERROR_IS_FATAL ANY is 3.19 and higher) macro(cmkr_exec) execute_process(COMMAND ${ARGV} RESULT_VARIABLE CMKR_EXEC_RESULT) diff --git a/src/cmkrlib/gen.cpp b/src/cmkrlib/gen.cpp index 7f0faef..f16a293 100644 --- a/src/cmkrlib/gen.cpp +++ b/src/cmkrlib/gen.cpp @@ -334,8 +334,11 @@ int generate_cmake(const char *path, bool root) { } }; - comment("This file was generated automatically by cmkr.").endl(); // TODO: add link with proper documentation + comment("This file was generated automatically by cmkr.").endl(); + + comment("Create a configure-time dependency on cmake.toml to improve IDE support"); + cmd("configure_file")("cmake.toml", "cmake.toml", "COPYONLY").endl(); cmake::CMake cmake(path, false);