summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-07-22 21:40:22 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-25 13:59:15 +0200
commit189a5d8af12788a30121210066de647a6dc3a167 (patch)
treeaebc213c29a70d00e704f9d9679a1f47622c7b5a /src/corelib
parent95191658d0b71017c8fcb19058ed900e97d8f81c (diff)
Create IMPORTED CMake targets for executables.
Although IMPORTED executables are not extra special, this is more future-proof in terms of both future CMake features and future our needs - it is possible that we would want to add a property to an executable at TARGET scope, which would not be possible if it is just a path. Change-Id: I649c601e004b21603c5fa97de0b7c397813ed68d Reviewed-by: Brad King <brad.king@kitware.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/Qt5CoreConfigExtras.cmake.in44
-rw-r--r--src/corelib/Qt5CoreMacros.cmake6
2 files changed, 41 insertions, 9 deletions
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index 4f918691ae..e5f7e14d82 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -1,15 +1,47 @@
get_filename_component(_qt5_corelib_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+if (NOT TARGET Qt5::qmake)
+ add_executable(Qt5::qmake IMPORTED)
+
+ set_target_properties(Qt5::qmake PROPERTIES
+!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+ IMPORTED_LOCATION \"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\"
+!!ELSE
+ IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\"
+!!ENDIF
+ )
+endif()
+
+if (NOT TARGET Qt5::moc)
+ add_executable(Qt5::moc IMPORTED)
+
+ set_target_properties(Qt5::moc PROPERTIES
+!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+ IMPORTED_LOCATION \"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\"
+!!ELSE
+ IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\"
+!!ENDIF
+ )
+ # For CMake automoc feature
+ get_target_property(QT_MOC_EXECUTABLE Qt5::moc LOCATION)
+endif()
+
+if (NOT TARGET Qt5::rcc)
+ add_executable(Qt5::rcc IMPORTED)
+
+ set_target_properties(Qt5::rcc PROPERTIES
!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
-set(QT_QMAKE_EXECUTABLE \"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
-set(QT_MOC_EXECUTABLE \"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
-set(QT_RCC_EXECUTABLE \"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ IMPORTED_LOCATION \"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\"
!!ELSE
-set(QT_QMAKE_EXECUTABLE \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
-set(QT_MOC_EXECUTABLE \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
-set(QT_RCC_EXECUTABLE \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\"
!!ENDIF
+ )
+endif()
+
+set(Qt5Core_QMAKE_EXECUTABLE Qt5::qmake)
+set(Qt5Core_MOC_EXECUTABLE Qt5::moc)
+set(Qt5Core_RCC_EXECUTABLE Qt5::rcc)
!!IF isEmpty(CMAKE_DATA_DIR_IS_ABSOLUTE)
list(APPEND Qt5Core_INCLUDE_DIRS \"${_qt5_corelib_install_prefix}/mkspecs/default\")
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
index 9d5f85a441..7cccefd014 100644
--- a/src/corelib/Qt5CoreMacros.cmake
+++ b/src/corelib/Qt5CoreMacros.cmake
@@ -108,13 +108,13 @@ macro(QT5_CREATE_MOC_COMMAND infile outfile moc_flags moc_options)
string(REPLACE ";" "\n" _moc_parameters "${_moc_parameters}")
file(WRITE ${_moc_parameters_file} "${_moc_parameters}")
add_custom_command(OUTPUT ${outfile}
- COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters
+ COMMAND ${Qt5Core_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters
DEPENDS ${infile}
${_moc_working_dir}
VERBATIM)
else()
add_custom_command(OUTPUT ${outfile}
- COMMAND ${QT_MOC_EXECUTABLE}
+ COMMAND ${Qt5Core_MOC_EXECUTABLE}
ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile}
DEPENDS ${infile} VERBATIM)
endif()
@@ -202,7 +202,7 @@ function(QT5_ADD_RESOURCES outfiles )
endif()
add_custom_command(OUTPUT ${outfile}
- COMMAND ${QT_RCC_EXECUTABLE}
+ COMMAND ${Qt5Core_RCC_EXECUTABLE}
ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile}
MAIN_DEPENDENCY ${infile}
DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM)