Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TEC Server Config
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MSK-SW
Infrastructure and Support
TEC
TEC Server Config
Commits
eb9db68a
Commit
eb9db68a
authored
1 year ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
fix(project-template): remove extra rpath from DOOCS imported targets
parent
75b9c352
No related branches found
No related tags found
1 merge request
!3
update project template
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmake/Modules/FindDOOCS.cmake
+22
-7
22 additions, 7 deletions
cmake/Modules/FindDOOCS.cmake
with
22 additions
and
7 deletions
cmake/Modules/FindDOOCS.cmake
+
22
−
7
View file @
eb9db68a
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
SET
(
DOOCS_FOUND 0
)
SET
(
DOOCS_FOUND 0
)
# if set, include the --no-as-needed linker flag which helps if inner dependencies between libs are not properly
# if set, include the --no-as-needed linker flag which helps if inner dependencies between libs are not properly
# set inside the library binaries
# set inside the library binaries
set
(
DOOCS_noAsNeededFlag 1
)
set
(
DOOCS_noAsNeededFlag 1
)
...
@@ -59,7 +59,7 @@ if (NOT DOOCS_FIND_QUIETLY)
...
@@ -59,7 +59,7 @@ if (NOT DOOCS_FIND_QUIETLY)
message
(
"FindDOOCS: Using PKG_CONFIG_PATH=$ENV{PKG_CONFIG_PATH}"
)
message
(
"FindDOOCS: Using PKG_CONFIG_PATH=$ENV{PKG_CONFIG_PATH}"
)
endif
()
endif
()
# We add the always - required API component
# We add the always - required API component
if
(
NOT
(
";
${
DOOCS_FIND_COMPONENTS
}
;"
MATCHES
";api;"
))
if
(
NOT
(
";
${
DOOCS_FIND_COMPONENTS
}
;"
MATCHES
";api;"
))
list
(
PREPEND DOOCS_FIND_COMPONENTS
"api"
)
list
(
PREPEND DOOCS_FIND_COMPONENTS
"api"
)
endif
()
endif
()
...
@@ -108,8 +108,9 @@ foreach(component ${DOOCS_FIND_COMPONENTS})
...
@@ -108,8 +108,9 @@ foreach(component ${DOOCS_FIND_COMPONENTS})
message
(
STATUS
"FindDOOCS: imported target is
${
importedTarget
}
. Defining alias DOOCS::
${
component
}
"
)
message
(
STATUS
"FindDOOCS: imported target is
${
importedTarget
}
. Defining alias DOOCS::
${
component
}
"
)
endif
()
endif
()
add_library
(
DOOCS::
${
component
}
ALIAS
${
importedTarget
}
)
add_library
(
DOOCS::
${
component
}
ALIAS
${
importedTarget
}
)
set
(
DOOCS_LIBRARIES
${
DOOCS_LIBRARIES
}
"DOOCS::
${
component
}
"
)
set
(
DOOCS_LIBRARIES
${
DOOCS_LIBRARIES
}
"DOOCS::
${
component
}
"
)
if
(
${
component
}
STREQUAL
"api"
)
if
(
${
component
}
STREQUAL
"api"
)
# add Threads lib only if not yet in
# add Threads lib only if not yet in
get_target_property
(
doocsLinkLibs
${
importedTarget
}
INTERFACE_LINK_LIBRARIES
)
get_target_property
(
doocsLinkLibs
${
importedTarget
}
INTERFACE_LINK_LIBRARIES
)
...
@@ -128,7 +129,21 @@ foreach(component ${DOOCS_FIND_COMPONENTS})
...
@@ -128,7 +129,21 @@ foreach(component ${DOOCS_FIND_COMPONENTS})
string
(
REGEX REPLACE
".*-NOTFOUND"
""
doocsLinkLibs
"
${
doocsLinkLibs
}
"
)
string
(
REGEX REPLACE
".*-NOTFOUND"
""
doocsLinkLibs
"
${
doocsLinkLibs
}
"
)
set_target_properties
(
${
importedTarget
}
PROPERTIES INTERFACE_LINK_LIBRARIES
"DOOCS::api;
${
doocsLinkLibs
}
"
)
set_target_properties
(
${
importedTarget
}
PROPERTIES INTERFACE_LINK_LIBRARIES
"DOOCS::api;
${
doocsLinkLibs
}
"
)
endif
()
endif
()
# strip the RPATH from the INTERFACE_LINK_OPTIONS of the imported target
# cmake will handle the RPATH properly itself when using imported targets. Adding the rpath linker flags
# explicitly will not only add the directories to the RPATH twice but also destroy the proper ordering,
# since the directories from the linker flags will be added first and e.g. the build directory will end up
# too late in the list. As a consequence, test executables might use the installed libraries instead of the
# library under test from the build directory - even for tests and libraries quite unrelated to DOOCS, as
# long as they have a DOOCS library as a (direct or indirect) dependency.
get_target_property
(
MY_LINK_OPTIONS
${
importedTarget
}
INTERFACE_LINK_OPTIONS
)
string
(
REGEX REPLACE
"-Wl,-rpath,[^;]*"
""
MY_LINK_OPTIONS
"
${
MY_LINK_OPTIONS
}
"
)
string
(
REGEX REPLACE
";;"
";"
MY_LINK_OPTIONS
"
${
MY_LINK_OPTIONS
}
"
)
string
(
REGEX REPLACE
"^;"
""
MY_LINK_OPTIONS
"
${
MY_LINK_OPTIONS
}
"
)
string
(
REGEX REPLACE
";$"
""
MY_LINK_OPTIONS
"
${
MY_LINK_OPTIONS
}
"
)
set_target_properties
(
${
importedTarget
}
PROPERTIES INTERFACE_LINK_OPTIONS
"
${
MY_LINK_OPTIONS
}
"
)
# print some info about targets
# print some info about targets
get_target_property
(
doocsIncDirs
${
importedTarget
}
INTERFACE_INCLUDE_DIRECTORIES
)
get_target_property
(
doocsIncDirs
${
importedTarget
}
INTERFACE_INCLUDE_DIRECTORIES
)
message
(
VERBOSE
" include dirs:
${
doocsIncDirs
}
"
)
message
(
VERBOSE
" include dirs:
${
doocsIncDirs
}
"
)
...
@@ -140,7 +155,7 @@ foreach(component ${DOOCS_FIND_COMPONENTS})
...
@@ -140,7 +155,7 @@ foreach(component ${DOOCS_FIND_COMPONENTS})
message
(
VERBOSE
" link libs:
${
doocsLinkLibs
}
"
)
message
(
VERBOSE
" link libs:
${
doocsLinkLibs
}
"
)
get_target_property
(
doocsLinkDirs
${
importedTarget
}
INTERFACE_LINK_DIRECTORIES
)
get_target_property
(
doocsLinkDirs
${
importedTarget
}
INTERFACE_LINK_DIRECTORIES
)
message
(
VERBOSE
" link dirs:
${
doocsLinkDirs
}
"
)
message
(
VERBOSE
" link dirs:
${
doocsLinkDirs
}
"
)
else
()
else
()
message
(
FATAL_ERROR
"DOOCS component
${
component
}
not found!"
)
message
(
FATAL_ERROR
"DOOCS component
${
component
}
not found!"
)
endif
()
endif
()
...
@@ -176,7 +191,7 @@ macro(DOOCS_appendListToList list arg)
...
@@ -176,7 +191,7 @@ macro(DOOCS_appendListToList list arg)
endforeach
()
endforeach
()
endmacro
()
endmacro
()
# note, pkg_check_modules output variables <prefix>_VERSION and <prefix>_LIBDIR are different,
# note, pkg_check_modules output variables <prefix>_VERSION and <prefix>_LIBDIR are different,
# depending on length of given module list!
# depending on length of given module list!
set
(
DOOCS_DIR
"
${
DOOCS_api_LIBDIR
}
"
)
set
(
DOOCS_DIR
"
${
DOOCS_api_LIBDIR
}
"
)
set
(
DOOCS_VERSION
"
${
DOOCS_api_VERSION
}
"
)
set
(
DOOCS_VERSION
"
${
DOOCS_api_VERSION
}
"
)
...
@@ -204,4 +219,4 @@ set(DOOCS_LINK_FLAGS ${DOOCS_LINKER_FLAGS})
...
@@ -204,4 +219,4 @@ set(DOOCS_LINK_FLAGS ${DOOCS_LINKER_FLAGS})
# use a macro provided by CMake to check if all the listed arguments are valid and set DOOCS_FOUND accordingly
# use a macro provided by CMake to check if all the listed arguments are valid and set DOOCS_FOUND accordingly
include
(
FindPackageHandleStandardArgs
)
include
(
FindPackageHandleStandardArgs
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS
(
DOOCS REQUIRED_VARS DOOCS_DIR VERSION_VAR DOOCS_VERSION
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS
(
DOOCS REQUIRED_VARS DOOCS_DIR VERSION_VAR DOOCS_VERSION
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment