@@ -761,7 +761,11 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
761761 cmd (" set_property" )(" GLOBAL" , " PROPERTY" , " USE_FOLDERS" , " ON" ).endl ();
762762
763763 comment (" Create a configure-time dependency on cmake.toml to improve IDE support" );
764- cmd (" configure_file" )(" cmake.toml" , " cmake.toml" , " COPYONLY" );
764+ if (project.cmake_minimum_version (3 , 0 )) {
765+ cmd (" set_property" )(" DIRECTORY" , " APPEND" , " PROPERTY" , " CMAKE_CONFIGURE_DEPENDS" , " cmake.toml" );
766+ } else {
767+ cmd (" configure_file" )(" cmake.toml" , " cmake.toml" , " COPYONLY" );
768+ }
765769
766770 if (project.project_msvc_runtime != parser::msvc_last) {
767771 cmd (" if" )(" NOT" , " DEFINED" , " CMAKE_MSVC_RUNTIME_LIBRARY" );
@@ -785,12 +789,14 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
785789 create_file (cmkr_include, resources::cmkr);
786790 }
787791 } else {
788- // clang-format off
789792 comment (" Create a configure-time dependency on cmake.toml to improve IDE support" );
790793 cmd (" if" )(" CMKR_ROOT_PROJECT" );
794+ if (project.cmake_minimum_version (3 , 0 )) {
795+ cmd (" set_property" )(" DIRECTORY" , " APPEND" , " PROPERTY" , " CMAKE_CONFIGURE_DEPENDS" , " cmake.toml" );
796+ } else {
791797 cmd (" configure_file" )(" cmake.toml" , " cmake.toml" , " COPYONLY" );
798+ }
792799 cmd (" endif" )().endl ();
793- // clang-format on
794800 }
795801
796802 // TODO: remove support and replace with global compile-features
0 commit comments