Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
morse_cmake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
solverstack
morse_cmake
Commits
bc34cfd2
Commit
bc34cfd2
authored
1 month ago
by
PRUVOST Florent
Browse files
Options
Downloads
Patches
Plain Diff
morse_export_imported_target: update to get also IMPORTED_LOCATION info
parent
4b72d980
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/find/FindMorseCommon.cmake
+41
-23
41 additions, 23 deletions
modules/find/FindMorseCommon.cmake
with
41 additions
and
23 deletions
modules/find/FindMorseCommon.cmake
+
41
−
23
View file @
bc34cfd2
...
@@ -194,18 +194,19 @@ macro(morse_create_imported_target name)
...
@@ -194,18 +194,19 @@ macro(morse_create_imported_target name)
endmacro
()
endmacro
()
# export existing imported target
namespace1::namespace2
in cmake file
# export existing imported target
${targetname}
in cmake file
# ${targetname}Targets.cmake and installed in lib/cmake/cmakesubdir/. To be used
# ${target
file
name}Targets.cmake and installed in lib/cmake/
${
cmakesubdir
}
/. To be used
# by "PROJECT"Config.cmake file at installation
# by "PROJECT"Config.cmake file at installation
macro
(
morse_export_imported_target namespace1 namespace2 targetname cmakesubdir
)
macro
(
morse_export_imported_target targetname targetfilename cmakesubdir
)
if
(
TARGET
${
namespace1
}
::
${
namespace2
}
)
if
(
TARGET
${
targetname
}
)
get_target_property
(
_INCLUDES
${
namespace1
}
::
${
namespace2
}
INTERFACE_INCLUDE_DIRECTORIES
)
get_target_property
(
_INCLUDES
${
targetname
}
INTERFACE_INCLUDE_DIRECTORIES
)
get_target_property
(
_LIBDIRS
${
namespace1
}
::
${
namespace2
}
INTERFACE_LINK_DIRECTORIES
)
get_target_property
(
_LIBDIRS
${
targetname
}
INTERFACE_LINK_DIRECTORIES
)
get_target_property
(
_LIBRARIES
${
namespace1
}
::
${
namespace2
}
INTERFACE_LINK_LIBRARIES
)
get_target_property
(
_LIBRARIES
${
targetname
}
INTERFACE_LINK_LIBRARIES
)
get_target_property
(
_CFLAGS
${
namespace1
}
::
${
namespace2
}
INTERFACE_COMPILE_OPTIONS
)
get_target_property
(
_CFLAGS
${
targetname
}
INTERFACE_COMPILE_OPTIONS
)
get_target_property
(
_DEFS
${
namespace1
}
::
${
namespace2
}
INTERFACE_COMPILE_DEFINITIONS
)
get_target_property
(
_DEFS
${
targetname
}
INTERFACE_COMPILE_DEFINITIONS
)
get_target_property
(
_LDFLAGS
${
namespace1
}
::
${
namespace2
}
INTERFACE_LINK_OPTIONS
)
get_target_property
(
_LDFLAGS
${
targetname
}
INTERFACE_LINK_OPTIONS
)
if
(
NOT _INCLUDES
)
if
(
NOT _INCLUDES
)
set
(
_INCLUDES
""
)
set
(
_INCLUDES
""
)
endif
()
endif
()
...
@@ -225,23 +226,40 @@ macro(morse_export_imported_target namespace1 namespace2 targetname cmakesubdir)
...
@@ -225,23 +226,40 @@ macro(morse_export_imported_target namespace1 namespace2 targetname cmakesubdir)
set
(
_LDFLAGS
""
)
set
(
_LDFLAGS
""
)
endif
()
endif
()
file
(
WRITE
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
targetname
}
Targets.cmake"
get_target_property
(
_IMPORTED_CONF
${
targetname
}
IMPORTED_CONFIGURATIONS
)
"if (NOT TARGET
${
namespace1
}
::
${
namespace2
}
)
if
(
NOT _IMPORTED_CONF
)
add_library(
${
namespace1
}
::
${
namespace2
}
INTERFACE IMPORTED)
set
(
_IMPORTED_CONF
"NOCONFIG"
)
set_target_properties(
${
namespace1
}
::
${
namespace2
}
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
\"
${
_INCLUDES
}
\"
)
endif
()
set_target_properties(
${
namespace1
}
::
${
namespace2
}
PROPERTIES INTERFACE_LINK_DIRECTORIES
\"
${
_LIBDIRS
}
\"
)
get_target_property
(
_IMPORTED_DEP
${
targetname
}
IMPORTED_LINK_DEPENDENT_LIBRARIES_
${
_IMPORTED_CONF
}
)
set_target_properties(
${
namespace1
}
::
${
namespace2
}
PROPERTIES INTERFACE_LINK_LIBRARIES
\"
${
_LIBRARIES
}
\"
)
get_target_property
(
_IMPORTED_LOCATION
${
targetname
}
IMPORTED_LOCATION_
${
_IMPORTED_CONF
}
)
set_target_properties(
${
namespace1
}
::
${
namespace2
}
PROPERTIES INTERFACE_COMPILE_OPTIONS
\"
${
_CFLAGS
}
\"
)
get_target_property
(
_IMPORTED_SONAME
${
targetname
}
IMPORTED_SONAME_
${
_IMPORTED_CONF
}
)
set_target_properties(
${
namespace1
}
::
${
namespace2
}
PROPERTIES INTERFACE_COMPILE_DEFINITIONS
\"
${
_DEFS
}
\"
)
if
(
_IMPORTED_DEP
)
set_target_properties(
${
namespace1
}
::
${
namespace2
}
PROPERTIES INTERFACE_LINK_OPTIONS
\"
${
_LDFLAGS
}
\"
)
list
(
PREPEND _LIBRARIES
${
_IMPORTED_DEP
}
)
endif
()
if
(
_IMPORTED_LOCATION
)
list
(
PREPEND _LIBRARIES
${
_IMPORTED_LOCATION
}
)
endif
()
file
(
WRITE
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
targetfilename
}
Targets.cmake"
"if (NOT TARGET
${
targetname
}
)
add_library(
${
targetname
}
INTERFACE IMPORTED)
set_target_properties(
${
targetname
}
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
\"
${
_INCLUDES
}
\"
)
set_target_properties(
${
targetname
}
PROPERTIES INTERFACE_LINK_DIRECTORIES
\"
${
_LIBDIRS
}
\"
)
set_target_properties(
${
targetname
}
PROPERTIES INTERFACE_LINK_LIBRARIES
\"
${
_LIBRARIES
}
\"
)
set_target_properties(
${
targetname
}
PROPERTIES INTERFACE_COMPILE_OPTIONS
\"
${
_CFLAGS
}
\"
)
set_target_properties(
${
targetname
}
PROPERTIES INTERFACE_COMPILE_DEFINITIONS
\"
${
_DEFS
}
\"
)
set_target_properties(
${
targetname
}
PROPERTIES INTERFACE_LINK_OPTIONS
\"
${
_LDFLAGS
}
\"
)
endif()
endif()
"
)
"
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
targetname
}
Targets.cmake"
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
target
file
name
}
Targets.cmake"
DESTINATION
"lib/cmake/
${
cmakesubdir
}
"
)
DESTINATION
"lib/cmake/
${
cmakesubdir
}
"
)
else
()
else
()
message
(
WARNING
"morse_export_imported_target: try to export target "
set
(
list_var
"
${
ARGV
}
"
)
"
${
namespace1
}
::
${
namespace2
}
but it does not exist."
)
if
(
NOT
"QUIET"
IN_LIST list_var
)
message
(
WARNING
"morse_export_imported_target_without_namespace: try to export target "
"
${
targetname
}
but it does not exist."
)
endif
()
endif
()
endif
()
endmacro
()
endmacro
()
...
...
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