forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindFairRoot.cmake
84 lines (72 loc) · 3.58 KB
/
FindFairRoot.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
# This software is distributed under the terms of the GNU General Public
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
#
# In applying this license CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.
# TODO: remove this file once FairRoot correctly exports its cmake config
find_path(FairRoot_INC FairDetector.h
PATH_SUFFIXES FairRoot/include
PATHS ${FAIRROOTPATH}/include
${FAIRROOT_ROOT}/include
$ENV{FAIRROOT_ROOT}/include)
get_filename_component(FairRoot_TOPDIR "${FairRoot_INC}/.." ABSOLUTE)
set(OLD_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
set(CMAKE_PREFIX_PATH ${FairRoot_TOPDIR})
find_library(FairRoot_Tools FairTools)
find_library(FairRoot_ParBase ParBase)
find_library(FairRoot_GeoBase GeoBase)
find_library(FairRoot_Base Base)
find_library(FairRoot_Gen Gen)
set(CMAKE_PREFIX_PATH ${OLD_CMAKE_PREFIX_PATH})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FairRoot
DEFAULT_MSG FairRoot_Base
FairRoot_Tools
FairRoot_ParBase
FairRoot_GeoBase
FairRoot_Gen
FairRoot_INC)
if(NOT TARGET FairRoot::Tools)
add_library(FairRoot::Tools IMPORTED INTERFACE)
set_target_properties(FairRoot::Tools
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${FairRoot_INC}
INTERFACE_LINK_LIBRARIES ${FairRoot_Tools})
target_link_libraries(FairRoot::Tools INTERFACE FairLogger::FairLogger)
endif()
if(NOT TARGET FairRoot::ParBase)
add_library(FairRoot::ParBase IMPORTED INTERFACE)
set_target_properties(FairRoot::ParBase
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${FairRoot_INC}
INTERFACE_LINK_LIBRARIES ${FairRoot_ParBase})
target_link_libraries(FairRoot::ParBase INTERFACE FairRoot::Tools)
endif()
if(NOT TARGET FairRoot::GeoBase)
add_library(FairRoot::GeoBase IMPORTED INTERFACE)
set_target_properties(FairRoot::GeoBase
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${FairRoot_INC}
INTERFACE_LINK_LIBRARIES ${FairRoot_GeoBase})
endif()
if(NOT TARGET FairRoot::Base)
add_library(FairRoot::Base IMPORTED INTERFACE)
get_filename_component(libdir ${FairRoot_Base} DIRECTORY)
set_target_properties(FairRoot::Base
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${FairRoot_INC}
INTERFACE_LINK_LIBRARIES ${FairRoot_Base}
INTERFACE_LINK_DIRECTORIES ${libdir})
target_link_libraries(FairRoot::Base
INTERFACE FairRoot::Tools FairRoot::ParBase FairRoot::GeoBase MC::VMC)
endif()
if(NOT TARGET FairRoot::Gen)
add_library(FairRoot::Gen IMPORTED INTERFACE)
set_target_properties(FairRoot::Gen
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${FairRoot_INC}
INTERFACE_LINK_LIBRARIES ${FairRoot_Gen})
target_link_libraries(FairRoot::Gen
INTERFACE FairRoot::ParBase FairRoot::Base
FairRoot::ParBase)
endif()