aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-12-04 10:42:08 +0100
committerEike Ziller <eike.ziller@qt.io>2020-12-04 10:33:47 +0000
commit9c8451e9a76f1173d4c7fa4d538e2ed676743110 (patch)
tree503a4f34c04d5626b1fac42be74446f777b08013
parentc18482ffdee204b1345b75a00ce78db77b1e5498 (diff)
Fix that target was accessed before it was created
Amends c21932163779bcfe4577ac2e3326b8c113884829 Change-Id: I078df77ebfd7921c9c8bcaf131ae06a3a1fcd181 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
-rw-r--r--cmake/QbsAPI.cmake22
-rw-r--r--doc/CMakeLists.txt1
-rw-r--r--share/CMakeLists.txt1
3 files changed, 14 insertions, 10 deletions
diff --git a/cmake/QbsAPI.cmake b/cmake/QbsAPI.cmake
index 2c64a0303..5d5fada99 100644
--- a/cmake/QbsAPI.cmake
+++ b/cmake/QbsAPI.cmake
@@ -43,17 +43,19 @@ else()
set(QBS_PLUGINS_RPATH "\$ORIGIN/${QBS_RELATIVE_PLUGINS_RPATH}")
endif()
-if(WIN32)
- get_target_property(_QTCORE_LIBRARY Qt5::Core IMPORTED_LOCATION_RELEASE)
- if(NOT _QTCORE_LIBRARY)
- get_target_property(_QTCORE_LIBRARY Qt5::Core IMPORTED_LOCATION_DEBUG)
+function(get_update_path_command var)
+ if(WIN32)
+ get_target_property(_QTCORE_LIBRARY Qt5::Core IMPORTED_LOCATION_RELEASE)
+ if(NOT _QTCORE_LIBRARY)
+ get_target_property(_QTCORE_LIBRARY Qt5::Core IMPORTED_LOCATION_DEBUG)
+ endif()
+ get_filename_component(_QT_LIBRARY_PATH "${_QTCORE_LIBRARY}" DIRECTORY)
+ get_target_property(_QBS_LIBRARY_PATH qbscore LIBRARY_OUTPUT_DIRECTORY)
+ set(${var} "set \"PATH=${_QT_LIBRARY_PATH}\;${_QBS_LIBRARY_PATH}\;%PATH%\"" PARENT_SCOPE)
+ else()
+ set(${var} "")
endif()
- get_filename_component(_QT_LIBRARY_PATH "${_QTCORE_LIBRARY}" DIRECTORY)
- get_target_property(_QBS_LIBRARY_PATH qbscore LIBRARY_OUTPUT_DIRECTORY)
- set(UPDATE_PATH_COMMAND set "PATH=${_QT_LIBRARY_PATH}\;${_QBS_LIBRARY_PATH}\;%PATH%")
-else()
- set(UPDATE_PATH_COMMAND "")
-endif()
+endfunction()
if(WITH_UNIT_TESTS)
set(QBS_UNIT_TESTS_DEFINES "QBS_ENABLE_UNIT_TESTS")
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 9357dcf63..81790f845 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -13,6 +13,7 @@ if (QBS_INSTALL_HTML_DOCS OR QBS_INSTALL_QCH_DOCS)
set(_INSTALL_QCH_DOCS false)
endif()
+ get_update_path_command(UPDATE_PATH_COMMAND)
add_custom_target(
BuildQbsDocumentation ALL
COMMAND ${UPDATE_PATH_COMMAND}
diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt
index 1e0f69df5..33dc2b2d0 100644
--- a/share/CMakeLists.txt
+++ b/share/CMakeLists.txt
@@ -32,6 +32,7 @@ install(
DESTINATION "${QBS_RESOURCES_INSTALL_DIR}/qbs"
)
+get_update_path_command(UPDATE_PATH_COMMAND)
get_target_property(_QBS_OUTPUT_DIR qbs RUNTIME_OUTPUT_DIRECTORY)
add_custom_target(
BuildQbsResources ALL