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
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Timo Koch
dune-common
Commits
2969da6c
Commit
2969da6c
authored
9 years ago
by
Steffen Müthing
Browse files
Options
Downloads
Patches
Plain Diff
[Release][CMake] Add support for compile options in DuneEnableAllPackages
parent
e83aaa8f
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
cmake/modules/DuneEnableAllPackages.cmake
+28
-4
28 additions, 4 deletions
cmake/modules/DuneEnableAllPackages.cmake
with
28 additions
and
4 deletions
cmake/modules/DuneEnableAllPackages.cmake
+
28
−
4
View file @
2969da6c
...
...
@@ -12,6 +12,7 @@
#
# dune_enable_all_packages(INCLUDE_DIRS [include_dirs]
# COMPILE_DEFINITIONS [compile_definitions]
# COMPILE_OPTIONS [compile_options]
# MODULE_LIBRARIES [libraries]
# [VERBOSE] [APPEND]
# )
...
...
@@ -51,6 +52,7 @@
#
#
# dune_register_package_flags(COMPILE_DEFINITIONS [flags]
# COMPILE_OPTIONS [options]
# INCLUDE_DIRS {includes]
# LIBRARIES [libs]
# [APPEND]
...
...
@@ -77,7 +79,7 @@ function(dune_register_package_flags)
include
(
CMakeParseArguments
)
set
(
OPTIONS APPEND
)
set
(
SINGLEARGS
)
set
(
MULTIARGS COMPILE_DEFINITIONS INCLUDE_DIRS LIBRARIES
)
set
(
MULTIARGS COMPILE_DEFINITIONS
COMPILE_OPTIONS
INCLUDE_DIRS LIBRARIES
)
cmake_parse_arguments
(
REGISTRY
"
${
OPTIONS
}
"
"
${
SINGLEARGS
}
"
"
${
MULTIARGS
}
"
${
ARGN
}
)
if
(
REGISTRY_UNPARSED_ARGUMENTS
)
...
...
@@ -88,13 +90,16 @@ function(dune_register_package_flags)
set_property
(
GLOBAL APPEND PROPERTY ALL_PKG_INCS
"
${
REGISTRY_INCLUDE_DIRS
}
"
)
set_property
(
GLOBAL APPEND PROPERTY ALL_PKG_LIBS
"
${
REGISTRY_LIBRARIES
}
"
)
set_property
(
GLOBAL APPEND PROPERTY ALL_PKG_DEFS
"
${
REGISTRY_COMPILE_DEFINITIONS
}
"
)
set_property
(
GLOBAL APPEND PROPERTY ALL_PKG_OPTS
"
${
REGISTRY_COMPILE_OPTIONS
}
"
)
else
(
REGISTRY_APPEND
)
get_property
(
all_incs GLOBAL PROPERTY ALL_PKG_INCS
)
get_property
(
all_libs GLOBAL PROPERTY ALL_PKG_LIBS
)
get_property
(
all_defs GLOBAL PROPERTY ALL_PKG_DEFS
)
get_property
(
all_defs GLOBAL PROPERTY ALL_PKG_OPTS
)
set_property
(
GLOBAL PROPERTY ALL_PKG_INCS
"
${
REGISTRY_INCLUDE_DIRS
}
"
"
${
all_incs
}
"
)
set_property
(
GLOBAL PROPERTY ALL_PKG_LIBS
"
${
REGISTRY_LIBRARIES
}
"
"
${
all_libs
}
"
)
set_property
(
GLOBAL PROPERTY ALL_PKG_DEFS
"
${
REGISTRY_COMPILE_DEFINITIONS
}
"
"
${
all_defs
}
"
)
set_property
(
GLOBAL PROPERTY ALL_PKG_OPTS
"
${
REGISTRY_COMPILE_OPTIONS
}
"
"
${
all_opts
}
"
)
endif
(
REGISTRY_APPEND
)
endfunction
(
dune_register_package_flags
)
...
...
@@ -140,14 +145,30 @@ function(dune_enable_all_packages)
# add compile definitions to all targets in module
get_property
(
all_defs GLOBAL PROPERTY ALL_PKG_DEFS
)
foreach
(
def
${
all_defs
}
)
add_definitions
(
"-D
${
def
}
"
)
endforeach
(
def in
${
all_defs
}
)
add_definitions
(
${
all_defs
}
)
# verbose output of compile definitions
if
(
DUNE_ENABLE_ALL_PACKAGES_VERBOSE
)
message
(
"Compile definitions for this project:
${
all_defs
}
"
)
endif
(
DUNE_ENABLE_ALL_PACKAGES_VERBOSE
)
# handle additional compile options specified in dune_enable_all_packages
if
(
DUNE_ENABLE_ALL_PACKAGES_COMPILE_OPTIONS
)
if
(
DUNE_ENABLE_ALL_PACKAGES_APPEND
)
set_property
(
GLOBAL APPEND PROPERTY ALL_PKG_OPTS
"
${
DUNE_ENABLE_ALL_PACKAGES_COMPILE_OPTIONS
}
"
)
else
(
DUNE_ENABLE_ALL_PACKAGES_APPEND
)
get_property
(
all_opts GLOBAL PROPERTY ALL_PKG_OPTS
)
set_property
(
GLOBAL PROPERTY ALL_PKG_OPTS
"
${
DUNE_ENABLE_ALL_PACKAGES_COMPILE_OPTIONS
}
"
"
${
all_opts
}
"
)
endif
(
DUNE_ENABLE_ALL_PACKAGES_APPEND
)
endif
(
DUNE_ENABLE_ALL_PACKAGES_COMPILE_OPTIONS
)
# add compile options to all targets in module
get_property
(
all_opts GLOBAL PROPERTY ALL_PKG_OPTS
)
add_compile_options
(
${
all_opts
}
)
# verbose output of compile definitions
if
(
DUNE_ENABLE_ALL_PACKAGES_VERBOSE
)
message
(
"Compile options for this project:
${
all_opts
}
"
)
endif
(
DUNE_ENABLE_ALL_PACKAGES_VERBOSE
)
# handle libraries
# this is a little tricky because the libraries defined within the current module require special
# handling to avoid tripping over CMake policies CMP022 and CMP038
...
...
@@ -212,6 +233,9 @@ function(dune_target_enable_all_packages)
get_property
(
all_defs GLOBAL PROPERTY ALL_PKG_DEFS
)
target_compile_definitions
(
${
_target
}
PUBLIC
${
all_defs
}
)
get_property
(
all_opts GLOBAL PROPERTY ALL_PKG_OPTS
)
target_compile_options
(
${
_target
}
PUBLIC
${
all_opts
}
)
get_property
(
all_libs GLOBAL PROPERTY ALL_PKG_LIBS
)
target_link_libraries
(
${
_target
}
PUBLIC
${
DUNE_LIBS
}
${
all_libs
}
)
...
...
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