Skip to content

Commit 075eb4a

Browse files
aphecetchesawenzel
authored andcommitted
Ensure we use only namespaced target names
1 parent 20fba10 commit 075eb4a

18 files changed

+127
-44
lines changed

Detectors/gconfig/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
o2_add_library(SimSetup
1212
SOURCES src/G3Config.cxx src/G4Config.cxx
1313
src/GlobalProcessCutSimParam.cxx src/SimSetup.cxx
14-
PUBLIC_LINK_LIBRARIES geant321
15-
geant4vmc
16-
geant4
14+
PUBLIC_LINK_LIBRARIES MC::Geant3
15+
MC::Geant4VMC
16+
MC::Geant4
1717
O2::SimulationDataFormat
1818
O2::DetectorsPassive
19-
pythia6 # this is needed by Geant3 and
20-
# EGPythia6
19+
MC::Pythia6 # this is needed by Geant3 and
20+
# EGPythia6
2121
ROOT::EGPythia6 # this is needed by Geant4
2222
# (TPythia6Decayer)
2323
)

Framework/ArrowTests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
o2_add_test(01
1212
SOURCES test/test_Arrow01.cxx
1313
COMPONENT_NAME arrow
14-
PUBLIC_LINK_LIBRARIES arrow_shared
14+
PUBLIC_LINK_LIBRARIES arrow::arrow_shared
1515
LABELS arrow)

Framework/Core/CMakeLists.txt

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ o2_add_library(Framework
110110
O2::MemoryResources
111111
O2::PCG
112112
RapidJSON::RapidJSON
113-
arrow_shared
113+
arrow::arrow_shared
114114
ms_gsl::ms_gsl
115115
ROOT::ROOTDataFrame
116116
${DEBUGGUI_TARGET}
@@ -271,26 +271,21 @@ foreach(w
271271
COMMAND_LINE_ARGS --run)
272272
endforeach()
273273

274-
# TODO: DanglingInput test not working for the moment
275-
# [ERROR] Unable to relay part.
276-
# [WARN] Incoming data is already obsolete, not relaying.
277-
set_property(TEST test_Framework_test_DanglingInputs
278-
PROPERTY DISABLED TRUE)
274+
# TODO: DanglingInput test not working for the moment [ERROR] Unable to relay
275+
# part. [WARN] Incoming data is already obsolete, not relaying.
276+
set_property(TEST test_Framework_test_DanglingInputs PROPERTY DISABLED TRUE)
279277

280-
# TODO: investigate the problem with the two unit tests, maybe setup of the CI environment
281-
# assertion fired
282-
# X11: The DISPLAY environment variable is missing
283-
# glfw-3.2.1/src/window.c:579: glfwGetFramebufferSize: Assertion `window != ((void *)0)' failed.
284-
set_property(TEST test_Framework_test_CustomGUIGL
285-
PROPERTY DISABLED TRUE)
286-
set_property(TEST test_Framework_test_CustomGUISokol
287-
PROPERTY DISABLED TRUE)
278+
# TODO: investigate the problem with the two unit tests, maybe setup of the CI
279+
# environment assertion fired X11: The DISPLAY environment variable is missing
280+
# glfw-3.2.1/src/window.c:579: glfwGetFramebufferSize: Assertion `window !=
281+
# ((void *)0)' failed.
282+
set_property(TEST test_Framework_test_CustomGUIGL PROPERTY DISABLED TRUE)
283+
set_property(TEST test_Framework_test_CustomGUISokol PROPERTY DISABLED TRUE)
288284

289285
# TODO: investigate the problem and re-enable
290286
set_property(TEST test_Framework_test_BoostSerializedProcessing
291287
PROPERTY DISABLED TRUE)
292288

293-
294289
# specific tests which needs command line options
295290
o2_add_test(
296291
ProcessorOptions NAME test_Framework_test_ProcessorOptions

Framework/DebugGUI/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if(GLFW_FOUND)
1616
src/GL3DUtils.cxx
1717
src/HandMade3DImpl.cxx
1818
src/DebugGUI.cxx)
19-
set(GUI_TARGET glfw)
19+
set(GUI_TARGET glfw::glfw)
2020
else()
2121
set(GUI_BACKEND src/Dummy3DUtils.cxx src/DummyDebugGUI.cxx)
2222
set(GUI_TARGET "")

Generators/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
# submit itself to any jurisdiction.
1010

1111
if(pythia_FOUND)
12-
set(pythiaTarget pythia)
12+
set(pythiaTarget MC::Pythia)
1313
endif()
1414

1515
if(HepMC_FOUND)
16-
set(hepmcTarget HepMC)
16+
set(hepmcTarget MC::HepMC)
1717
endif()
1818

1919
o2_add_library(Generators
@@ -67,7 +67,7 @@ o2_add_test_root_macro(share/external/extgen.C
6767
LABELS generators)
6868
if(pythia6_FOUND)
6969
o2_add_test_root_macro(share/external/pythia6.C
70-
PUBLIC_LINK_LIBRARIES O2::Generators pythia6
70+
PUBLIC_LINK_LIBRARIES O2::Generators MC::Pythia6
7171
LABELS generators)
7272
endif()
7373
o2_add_test_root_macro(share/external/tgenerator.C

cmake/O2AddExecutable.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ function(o2_add_executable baseTargetName)
105105

106106
# use its dependencies
107107
foreach(lib IN LISTS A_PUBLIC_LINK_LIBRARIES)
108+
string(FIND ${lib} "::" NS)
109+
if(${NS} EQUAL -1)
110+
message(FATAL_ERROR "Trying to use a non-namespaced target ${lib}")
111+
endif()
108112
target_link_libraries(${target} PUBLIC ${lib})
109113
endforeach()
110114

cmake/O2AddLibrary.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ function(o2_add_library baseTargetName)
8484
# Start by adding the dependencies to other targets
8585
if(A_PUBLIC_LINK_LIBRARIES)
8686
foreach(L IN LISTS A_PUBLIC_LINK_LIBRARIES)
87+
string(FIND ${L} "::" NS)
88+
if(${NS} EQUAL -1)
89+
message(FATAL_ERROR "Trying to use a non-namespaced target ${L}")
90+
endif()
8791
target_link_libraries(${target} PUBLIC ${L})
8892
endforeach()
8993
endif()

cmake/O2AddTestRootMacro.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ function(o2_add_test_root_macro macro)
7272

7373
get_filename_component(macroFileName ${macro} ABSOLUTE)
7474

75-
7675
if(NOT EXISTS ${macroFileName})
7776
message(
7877
FATAL_ERROR
@@ -91,6 +90,14 @@ function(o2_add_test_root_macro macro)
9190

9291
# Get all the include dir dependencies
9392
foreach(t IN LISTS A_PUBLIC_LINK_LIBRARIES)
93+
string(FIND ${t} "::" NS)
94+
if(${NS} EQUAL -1)
95+
message(
96+
WARNING
97+
"Trying to use a non-namespaced target ${t} for ${testName} test so I won't be able to generate that test."
98+
)
99+
return()
100+
endif()
94101
list(APPEND dependencies ${t})
95102
endforeach()
96103

dependencies/FindGLFW.cmake

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright CERN and copyright holders of ALICE O2. This software is distributed
2+
# under the terms of the GNU General Public License v3 (GPL Version 3), copied
3+
# verbatim in the file "COPYING".
4+
#
5+
# See http://alice-o2.web.cern.ch/license for full licensing information.
6+
#
7+
# In applying this license CERN does not waive the privileges and immunities
8+
# granted to it by virtue of its status as an Intergovernmental Organization or
9+
# submit itself to any jurisdiction.
10+
11+
# Simply provide a namespaced alias for the existing target
12+
13+
find_package(GLFW NAMES glfw3 CONFIG)
14+
if(NOT GLFW_FOUND)
15+
return()
16+
endif()
17+
18+
# Promote the imported target to global visibility
19+
# (so we can alias it)
20+
set_target_properties(glfw PROPERTIES IMPORTED_GLOBAL TRUE)
21+
22+
add_library(glfw::glfw ALIAS glfw)

dependencies/FindGeant3.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ endif()
1919
set_target_properties(geant321
2020
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
2121
"${Geant3_INCLUDE_DIRS}")
22+
23+
# Promote the imported target to global visibility
24+
# (so we can alias it)
25+
set_target_properties(geant321 PROPERTIES IMPORTED_GLOBAL TRUE)
26+
27+
add_library(MC::Geant3 ALIAS geant321)

0 commit comments

Comments
 (0)