Browse Source

Autogen: Add CMAKE_AUTO*_EXECUTABLE variables

Add the `CMAKE_AUTOMOC_EXECUTABLE`, `CMAKE_AUTOUIC_EXECUTABLE`, and
`CMAKE_AUTORCC_EXECUTABLE` variables to initialize the corresponding
`AUTO{MOC,UIC,RCC}_EXECUTABLE` target properties.

Fixes: #20071
Orkun Tokdemir 2 years ago
parent
commit
b3d1797508

+ 3 - 0
Auxiliary/vim/syntax/cmake.vim

@@ -690,11 +690,14 @@ syn keyword cmakeVariable contained
             \ CMAKE_AUTOMOC_MOC_OPTIONS
             \ CMAKE_AUTOMOC_PATH_PREFIX
             \ CMAKE_AUTOMOC_RELAXED_MODE
+            \ CMAKE_AUTOMOC_EXECUTABLE
             \ CMAKE_AUTORCC
             \ CMAKE_AUTORCC_OPTIONS
+            \ CMAKE_AUTORCC_EXECUTABLE
             \ CMAKE_AUTOUIC
             \ CMAKE_AUTOUIC_OPTIONS
             \ CMAKE_AUTOUIC_SEARCH_PATHS
+            \ CMAKE_AUTOUIC_EXECUTABLE
             \ CMAKE_BACKWARDS_COMPATIBILITY
             \ CMAKE_BINARY_DIR
             \ CMAKE_BUILD_RPATH

+ 3 - 0
Help/manual/cmake-variables.7.rst

@@ -403,11 +403,14 @@ Variables that Control the Build
    /variable/CMAKE_AUTOMOC_MACRO_NAMES
    /variable/CMAKE_AUTOMOC_MOC_OPTIONS
    /variable/CMAKE_AUTOMOC_PATH_PREFIX
+   /variable/CMAKE_AUTOMOC_EXECUTABLE
    /variable/CMAKE_AUTORCC
    /variable/CMAKE_AUTORCC_OPTIONS
+   /variable/CMAKE_AUTORCC_EXECUTABLE
    /variable/CMAKE_AUTOUIC
    /variable/CMAKE_AUTOUIC_OPTIONS
    /variable/CMAKE_AUTOUIC_SEARCH_PATHS
+   /variable/CMAKE_AUTOUIC_EXECUTABLE
    /variable/CMAKE_BUILD_RPATH
    /variable/CMAKE_BUILD_RPATH_USE_ORIGIN
    /variable/CMAKE_BUILD_WITH_INSTALL_NAME_DIR

+ 7 - 0
Help/release/dev/autogen-exe-vars.rst

@@ -0,0 +1,7 @@
+autogen-exe-vars
+----------------
+
+* The :variable:`CMAKE_AUTOMOC_EXECUTABLE`,
+  :variable:`CMAKE_AUTORCC_EXECUTABLE`, and
+  :variable:`CMAKE_AUTOUIC_EXECUTABLE` variables were added to initialize the
+  corresponding target properties as targets are created.

+ 10 - 0
Help/variable/CMAKE_AUTOMOC_EXECUTABLE.rst

@@ -0,0 +1,10 @@
+CMAKE_AUTOMOC_EXECUTABLE
+------------------------
+
+.. versionadded:: 3.27
+
+This variable is used to initialize the :prop_tgt:`AUTOMOC_EXECUTABLE`
+property on all the targets. See that target property for additional
+information.
+
+By default it is empty.

+ 10 - 0
Help/variable/CMAKE_AUTORCC_EXECUTABLE.rst

@@ -0,0 +1,10 @@
+CMAKE_AUTORCC_EXECUTABLE
+------------------------
+
+.. versionadded:: 3.27
+
+This variable is used to initialize the :prop_tgt:`AUTORCC_EXECUTABLE`
+property on all the targets. See that target property for additional
+information.
+
+By default it is empty.

+ 10 - 0
Help/variable/CMAKE_AUTOUIC_EXECUTABLE.rst

@@ -0,0 +1,10 @@
+CMAKE_AUTOUIC_EXECUTABLE
+------------------------
+
+.. versionadded:: 3.27
+
+This variable is used to initialize the :prop_tgt:`AUTOUIC_EXECUTABLE`
+property on all the targets. See that target property for additional
+information.
+
+By default it is empty.

+ 3 - 0
Source/cmTarget.cxx

@@ -438,13 +438,16 @@ TargetProperty const StaticTargetProperties[] = {
   { "AUTOMOC_MACRO_NAMES"_s, IC::CanCompileSources },
   { "AUTOMOC_MOC_OPTIONS"_s, IC::CanCompileSources },
   { "AUTOMOC_PATH_PREFIX"_s, IC::CanCompileSources },
+  { "AUTOMOC_EXECUTABLE"_s, IC::CanCompileSources },
   // ---- uic
   { "AUTOUIC"_s, IC::CanCompileSources },
   { "AUTOUIC_OPTIONS"_s, IC::CanCompileSources },
   { "AUTOUIC_SEARCH_PATHS"_s, IC::CanCompileSources },
+  { "AUTOUIC_EXECUTABLE"_s, IC::CanCompileSources },
   // ---- rcc
   { "AUTORCC"_s, IC::CanCompileSources },
   { "AUTORCC_OPTIONS"_s, IC::CanCompileSources },
+  { "AUTORCC_EXECUTABLE"_s, IC::CanCompileSources },
 
   // Linking properties
   { "ENABLE_EXPORTS"_s, IC::TargetWithSymbolExports },

+ 30 - 0
Tests/QtAutogen/GlobalAutogenExecutable/CMakeLists.txt

@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 3.26)
+project(GlobalAutogenExecutable)
+
+include("../AutogenCoreTest.cmake")
+
+set(test_automoc_path "global_automoc_exe_path")
+set(test_autouic_path "global_autouic_exe_path")
+set(test_autorcc_path "global_autorcc_exe_path")
+
+set(CMAKE_AUTOMOC_EXECUTABLE ${test_automoc_path})
+set(CMAKE_AUTOUIC_EXECUTABLE ${test_autouic_path})
+set(CMAKE_AUTORCC_EXECUTABLE ${test_autorcc_path})
+
+add_executable(autogen_test main.cpp)
+
+get_target_property(target_automoc_path autogen_test AUTOMOC_EXECUTABLE)
+get_target_property(target_autouic_path autogen_test AUTOUIC_EXECUTABLE)
+get_target_property(target_autorcc_path autogen_test AUTORCC_EXECUTABLE)
+
+if(NOT ${target_automoc_path} STREQUAL ${test_automoc_path})
+  message(FATAL_ERROR "CMAKE_AUTOMOC_EXECUTABLE not set")
+endif()
+
+if (NOT ${target_autouic_path} STREQUAL ${test_autouic_path})
+  message(FATAL_ERROR "CMAKE_AUTOUIC_EXECUTABLE not set")
+endif()
+
+if (NOT ${target_autorcc_path} STREQUAL ${test_autorcc_path})
+  message(FATAL_ERROR "CMAKE_AUTORCC_EXECUTABLE not set")
+endif()

+ 4 - 0
Tests/QtAutogen/GlobalAutogenExecutable/main.cpp

@@ -0,0 +1,4 @@
+int main()
+{
+  return 0;
+}

+ 1 - 0
Tests/QtAutogen/Tests.cmake

@@ -4,6 +4,7 @@ ADD_AUTOGEN_TEST(AutogenOriginDependsOn)
 ADD_AUTOGEN_TEST(AutogenTargetDepends)
 ADD_AUTOGEN_TEST(Complex QtAutogen)
 ADD_AUTOGEN_TEST(GlobalAutogenTarget)
+ADD_AUTOGEN_TEST(GlobalAutogenExecutable)
 ADD_AUTOGEN_TEST(LowMinimumVersion lowMinimumVersion)
 ADD_AUTOGEN_TEST(ManySources manySources)
 ADD_AUTOGEN_TEST(MocOnly mocOnly)