summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-04-28 17:33:29 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-04-29 23:08:32 +0200
commit062b50abff6a3cb2319ade41dddf76caa36f27e3 (patch)
tree7a0ec6ab28500b2a84d6edcc240d9bc6a309549d /cmake
parent317cfb677464a9610e4b46971e508b90f59b90f6 (diff)
CMake: Namespace all our IMPORTED targets
CMake IMPORTED targets should be namespaced so that CMake knows that the name refers to a target and not a file. Use the existing WrapXXX naming scheme where applicable. Fixes: QTBUG-83773 Change-Id: I5b0b722c811200c56c260c69e76940a625228769 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindSlog2.cmake8
-rw-r--r--cmake/FindWrapAtomic.cmake (renamed from cmake/FindAtomic.cmake)10
-rw-r--r--cmake/FindWrapRt.cmake6
3 files changed, 11 insertions, 13 deletions
diff --git a/cmake/FindSlog2.cmake b/cmake/FindSlog2.cmake
index dfb6635a39..807ab6b12a 100644
--- a/cmake/FindSlog2.cmake
+++ b/cmake/FindSlog2.cmake
@@ -11,9 +11,7 @@ find_package_handle_standard_args(Slog2 DEFAULT_MSG Slog2_INCLUDE_DIR Slog2_LIBR
mark_as_advanced(Slog2_INCLUDE_DIR Slog2_LIBRARY)
if(Slog2_FOUND)
- add_library(__Slog2 INTERFACE IMPORTED)
- target_link_libraries(__Slog2 INTERFACE ${Slog2_LIBRARY})
- target_include_directories(__Slog2 INTERFACE ${Slog2_INCLUDE_DIR})
-
- add_library(Slog2::Slog2 ALIAS __Slog2)
+ add_library(Slog2::Slog2 INTERFACE IMPORTED)
+ target_link_libraries(Slog2::Slog2 INTERFACE ${Slog2_LIBRARY})
+ target_include_directories(Slog2::Slog2 INTERFACE ${Slog2_INCLUDE_DIR})
endif()
diff --git a/cmake/FindAtomic.cmake b/cmake/FindWrapAtomic.cmake
index 91cee62046..c65ee1da06 100644
--- a/cmake/FindAtomic.cmake
+++ b/cmake/FindWrapAtomic.cmake
@@ -1,7 +1,7 @@
# We can't create the same interface imported target multiple times, CMake will complain if we do
# that. This can happen if the find_package call is done in multiple different subdirectories.
-if(TARGET Atomic)
- set(Atomic_FOUND ON)
+if(TARGET WrapAtomic::WrapAtomic)
+ set(WrapAtomic_FOUND ON)
return()
endif()
@@ -36,9 +36,9 @@ if(NOT HAVE_STDATOMIC)
set(CMAKE_REQUIRE_LIBRARIES "${_req_libraries}")
endif()
-add_library(Atomic INTERFACE IMPORTED)
+add_library(WrapAtomic::WrapAtomic INTERFACE IMPORTED)
if(HAVE_STDATOMIC_WITH_LIB)
- target_link_libraries(Atomic INTERFACE atomic)
+ target_link_libraries(WrapAtomic::WrapAtomic INTERFACE atomic)
endif()
-set(Atomic_FOUND 1)
+set(WrapAtomic_FOUND 1)
diff --git a/cmake/FindWrapRt.cmake b/cmake/FindWrapRt.cmake
index 0e57cadef5..6a138d348f 100644
--- a/cmake/FindWrapRt.cmake
+++ b/cmake/FindWrapRt.cmake
@@ -1,6 +1,6 @@
# We can't create the same interface imported target multiple times, CMake will complain if we do
# that. This can happen if the find_package call is done in multiple different subdirectories.
-if(TARGET WrapRt)
+if(TARGET WrapRt::WrapRt)
set(WrapRt_FOUND ON)
return()
endif()
@@ -30,8 +30,8 @@ cmake_pop_check_state()
if(HAVE_GETTIME)
set(WrapRt_FOUND ON)
- add_library(WrapRt INTERFACE IMPORTED)
+ add_library(WrapRt::WrapRt INTERFACE IMPORTED)
if (LIBRT_FOUND)
- target_link_libraries(WrapRt INTERFACE "${LIBRT}")
+ target_link_libraries(WrapRt::WrapRt INTERFACE "${LIBRT}")
endif()
endif()