Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Core Modules
dune-common
Commits
bea013a3
Commit
bea013a3
authored
1 year ago
by
Santiago Ospina De Los Ríos
Browse files
Options
Downloads
Patches
Plain Diff
Export all target [un]aliased and [un]scoped combinations
parent
7c88fd4a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1247
Export targets under custom namespaces (Dune:: by default)
Pipeline
#61744
canceled
1 year ago
Stage: .pre
Stage: test
Stage: downstream
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cmake/modules/DuneAddLibrary.cmake
+24
-22
24 additions, 22 deletions
cmake/modules/DuneAddLibrary.cmake
cmake/modules/DuneProject.cmake
+20
-17
20 additions, 17 deletions
cmake/modules/DuneProject.cmake
cmake/pkg/dune-common-config.cmake.in
+1
-1
1 addition, 1 deletion
cmake/pkg/dune-common-config.cmake.in
with
45 additions
and
40 deletions
cmake/modules/DuneAddLibrary.cmake
+
24
−
22
View file @
bea013a3
...
...
@@ -189,25 +189,25 @@ function(dune_add_library_normal _name)
"We recommend to choose an export name with a camel title case matching your library name "
"(e.g., Common, ISTL, and MultiDomainGrid will be exported as Dune::Common, Dune::ISTL, and Dune::MultiDomainGrid)
\n
"
" * Calls to `dune_add_library(<lib> ...)` without export specification will be supported until Dune 2.11
\n
"
" * Consumption of unscoped targets `<lib>` will be supported until Dune 2.12"
)
set
(
ARG_EXPORT_NAME
${
_name
}
)
set
(
ARG_EXPORT_NAME
__dune_impl_
${
_name
}
)
endif
()
set
(
${
ProjectName
}
_EXPORT_SET
${
ProjectName
}
-targets CACHE INTERNAL
""
)
# Install targets to use the libraries in other modules.
add_library
(
Dune::
${
ARG_EXPORT_NAME
}
ALIAS
${
_name
}
)
set_target_properties
(
${
_name
}
PROPERTIES EXPORT_NAME
${
ARG_EXPORT_NAME
}
)
install
(
TARGETS
${
_name
}
EXPORT
${
ProjectName
}
-targets-scoped DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
set
(
${
ProjectName
}
_EXPORT_SET_SCOPED
${
ProjectName
}
-targets-scoped CACHE INTERNAL
""
)
EXPORT
${${
ProjectName
}
_EXPORT_SET
}
DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
# Install (un
scop
ed) targets to use the libraries in other modules.
add_library
(
_dune_unscoped_
${
_name
}
INTERFACE
)
target_link
_librar
ies
(
_dune_un
scop
ed_
${
_name
}
INTERFACE
Dune::
${
ARG_EXPORT_NAME
}
)
set_
target_
propert
ies
(
_dune_un
scop
ed_
${
_name
}
PROPERTIES
EXPORT_NAME
${
_name
}
)
install
(
TARGETS
_dune_un
scop
ed_
${
_name
}
EXPORT
${
ProjectName
}
-targets-unscoped DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
set
(
${
ProjectName
}
_EXPORT_SET
_UNSCOPED
${
ProjectName
}
-targets-unscoped CACHE INTERNAL
""
)
# Install (un
alias
ed) targets to use the libraries in other modules.
# NOTE: Remove when compatibility with 2.10 is not needed anymore (e.g., 2.13
)
add
_librar
y
(
_dune_un
alias
ed_
${
_name
}
INTERFACE
)
target_
link_librar
ies
(
_dune_un
alias
ed_
${
_name
}
INTERFACE Dune::
${
ARG_
EXPORT_NAME
}
)
set_target_properties
(
_dune_un
alias
ed_
${
_name
}
PROPERTIES EXPORT_NAME
${
_name
}
)
install
(
TARGETS _dune_unaliased_
${
_name
}
EXPORT
${
${
ProjectName
}
_EXPORT_SET
}
DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
# Register target as an exported library
if
(
NOT ARG_NO_MODULE_LIBRARY
)
...
...
@@ -248,24 +248,26 @@ function(dune_add_library_interface _name)
"We recommend to choose an export name with a camel title case matching your library name "
"(e.g., Common, ISTL, and MultiDomainGrid will be exported as Dune::Common, Dune::ISTL, and Dune::MultiDomainGrid)
\n
"
" * Calls to `dune_add_library(<lib> ...)` without export specification will be supported until Dune 2.11
\n
"
" * Consumption of unscoped targets `<lib>` will be supported until Dune 2.12"
)
set
(
ARG_EXPORT_NAME
${
_name
}
)
set
(
ARG_EXPORT_NAME
__dune_impl_
${
_name
}
)
endif
()
set
(
${
ProjectName
}
_EXPORT_SET
${
ProjectName
}
-targets CACHE INTERNAL
""
)
# Install targets to use the libraries in other modules.
add_library
(
Dune::
${
ARG_EXPORT_NAME
}
ALIAS
${
_name
}
)
set_target_properties
(
${
_name
}
PROPERTIES EXPORT_NAME
${
ARG_EXPORT_NAME
}
)
install
(
TARGETS
${
_name
}
EXPORT
${
ProjectName
}
-targets-scoped DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
set
(
${
ProjectName
}
_EXPORT_SET_SCOPED
${
ProjectName
}
-targets-scoped CACHE INTERNAL
""
)
# Install (unscoped) targets to use the libraries in other modules.
add_library
(
_dune_unscoped_
${
_name
}
INTERFACE
)
target_link_libraries
(
_dune_unscoped_
${
_name
}
INTERFACE Dune::
${
ARG_EXPORT_NAME
}
)
set_target_properties
(
_dune_unscoped_
${
_name
}
PROPERTIES EXPORT_NAME
${
_name
}
)
install
(
TARGETS _dune_unscoped_
${
_name
}
EXPORT
${
ProjectName
}
-targets-unscoped DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
set
(
${
ProjectName
}
_EXPORT_SET_UNSCOPED
${
ProjectName
}
-targets-unscoped CACHE INTERNAL
""
)
EXPORT
${${
ProjectName
}
_EXPORT_SET
}
DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
# Install (unaliased) targets to use the libraries in other modules.
# NOTE: Remove when compatibility with 2.10 is not needed anymore (e.g., 2.13)
add_library
(
_dune_unaliased_
${
_name
}
INTERFACE
)
target_link_libraries
(
_dune_unaliased_
${
_name
}
INTERFACE Dune::
${
ARG_EXPORT_NAME
}
)
set_target_properties
(
_dune_unaliased_
${
_name
}
PROPERTIES EXPORT_NAME
${
_name
}
)
install
(
TARGETS _dune_unaliased_
${
_name
}
EXPORT
${${
ProjectName
}
_EXPORT_SET
}
DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
# Register target as an exported library
if
(
NOT ARG_NO_MODULE_LIBRARY
)
...
...
This diff is collapsed.
Click to expand it.
cmake/modules/DuneProject.cmake
+
20
−
17
View file @
bea013a3
...
...
@@ -214,7 +214,7 @@ if(${ProjectName}_LIBRARIES)
include(
\"\$
{_dir}/
${
ProjectName
}
-targets-scoped.cmake
\"
)
include(
\"\$
{_dir}/
${
ProjectName
}
-targets-unscoped.cmake
\"
)
# Deprecation warning for unscoped targets
if(
(
CMAKE_VERSION VERSION_GREATER_EQUAL
\"
3.19
\"
) AND (DUNE_COMMON_VERSION VERSION_GREATER_EQUAL
\"
2.12
\"
)
)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
@DUNE_DEPRECATED_LIBRARY_ALIASES@
endif()
endif()
...
...
@@ -237,14 +237,18 @@ endif()")
set
(
DUNE_INSTALL_LIBDIR
${
DUNE_INSTALL_NONOBJECTLIBDIR
}
)
endif
()
# setup deprecated aliases
foreach
(
_export_name
${${
ProjectName
}
_INTERFACE_LIBRARIES
}
)
get_target_property
(
_aliased_name
${
_export_name
}
ALIASED_TARGET
)
set
(
DUNE_DEPRECATED_LIBRARY_ALIASES
# add deprecated property for unaliased targets
if
(
${
ProjectVersionString
}
VERSION_GREATER_EQUAL 2.11
)
foreach
(
_interface_name
${${
ProjectName
}
_INTERFACE_LIBRARIES
}
)
get_target_property
(
_unaliased_name
${
_interface_name
}
ALIASED_TARGET
)
get_target_property
(
_export_unaliased_name
${
_unaliased_name
}
EXPORT_NAME
)
set
(
DUNE_DEPRECATED_LIBRARY_ALIASES
"
${
DUNE_DEPRECATED_LIBRARY_ALIASES
}
set_property(TARGET
${
_aliased_name
}
PROPERTY DEPRECATION
\"
Replace `
${
_aliased_name
}
` to new scoped `
${
_export_name
}
` targets.
\"
)
"
)
endforeach
()
set_property(TARGET
${
_unaliased_name
}
PROPERTY DEPRECATION
\"
Replace `
${
_unaliased_name
}
` to new scoped `
${
_interface_name
}
` targets.
\"
)
set_property(TARGET
${
_export_unaliased_name
}
PROPERTY DEPRECATION
\"
Replace `
${
_export_unaliased_name
}
` to new scoped `
${
_interface_name
}
` targets.
\"
)"
)
endforeach
()
endif
()
# Set the location of the doc file source. Needed by custom package configuration
# file section of dune-grid.
...
...
@@ -322,27 +326,26 @@ endif()
# install pkg-config files
create_and_install_pkconfig
(
${
DUNE_INSTALL_LIBDIR
}
)
if
(
${
ProjectName
}
_EXPORT_SET
_SCOPED
)
if
(
${
ProjectName
}
_EXPORT_SET
)
# install library export set
install
(
EXPORT
${${
ProjectName
}
_EXPORT_SET
_SCOPED
}
install
(
EXPORT
${${
ProjectName
}
_EXPORT_SET
}
DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
/cmake/
${
ProjectName
}
NAMESPACE Dune::
FILE
${
ProjectName
}
-targets-scoped.cmake
)
# export libraries for use in build tree
export
(
EXPORT
${${
ProjectName
}
_EXPORT_SET
_SCOPED
}
export
(
EXPORT
${${
ProjectName
}
_EXPORT_SET
}
FILE
${
PROJECT_BINARY_DIR
}
/
${
ProjectName
}
-targets-scoped.cmake
NAMESPACE Dune::
)
endif
()
if
(
${
ProjectName
}
_EXPORT_SET_UNSCOPED
)
# install library export set
install
(
EXPORT
${${
ProjectName
}
_EXPORT_SET
_UNSCOPED
}
# NOTE: Remove when compatibility with 2.10 is not needed anymore (e.g., 2.13
)
# install
(unscoped)
library export set
install
(
EXPORT
${${
ProjectName
}
_EXPORT_SET
}
DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
/cmake/
${
ProjectName
}
FILE
${
ProjectName
}
-targets-unscoped.cmake
)
# export libraries for use in build tree
export
(
EXPORT
${${
ProjectName
}
_EXPORT_SET
_UNSCOPED
}
# export
(unscoped)
libraries for use in build tree
export
(
EXPORT
${${
ProjectName
}
_EXPORT_SET
}
FILE
${
PROJECT_BINARY_DIR
}
/
${
ProjectName
}
-targets-unscoped.cmake
)
endif
()
...
...
This diff is collapsed.
Click to expand it.
cmake/pkg/dune-common-config.cmake.in
+
1
−
1
View file @
bea013a3
...
...
@@ -26,7 +26,7 @@ set(@DUNE_MOD_NAME@_SUGGESTS "@DUNE_SUGGESTS@")
set(@DUNE_MOD_NAME@_HASPYTHON 1)
set(@DUNE_MOD_NAME@_PYTHONREQUIRES "@DUNE_MODULE_PYTHONREQUIRES@")
set_and_check(@DUNE_MOD_NAME@_MODULE_PATH "@PACKAGE_DUNE_INSTALL_MODULEDIR@")
if((CMAKE_VERSION VERSION_GREATER_EQUAL 3.19) AND (
DUNE_COMMON_VERSION
VERSION_GREATER_EQUAL 2.1
2
))
if((CMAKE_VERSION VERSION_GREATER_EQUAL 3.19) AND (
@ProjectVersionString@
VERSION_GREATER_EQUAL 2.1
1
))
set_property(TARGET dunecommon PROPERTY DEPRECATION "Replace `dunecommon` to new scoped `Dune::Common` targets.")
endif()
endif(NOT @DUNE_MOD_NAME@_FOUND)
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