Generate configure_file for every cmake.toml file

vcpkg-wip
Duncan Ogilvie 4 years ago
parent c51f9cd311
commit 6e48ec7782

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

@ -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);

Loading…
Cancel
Save