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
b6987367
Commit
b6987367
authored
10 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
[Cmake] Add macros for copying files from the source tree to the build tree.
Taken from #FS1535, where Carsten has posted this code.
parent
1ca7dbfd
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/DuneMacros.cmake
+36
-0
36 additions, 0 deletions
cmake/modules/DuneMacros.cmake
with
36 additions
and
0 deletions
cmake/modules/DuneMacros.cmake
+
36
−
0
View file @
b6987367
...
...
@@ -1162,6 +1162,42 @@ macro(add_dune_all_flags targets)
endforeach
()
endmacro
(
add_dune_all_flags targets
)
# This macro adds a file-copy command.
# The file_name is the name of a file that exists
# in the source tree. This file will be copied
# to the build tree when executing this command.
# Notice that this does not create a top-level
# target. In order to do this you have to additionally
# call add_custom_target(...) with dependency
# on the file.
macro
(
dune_add_copy_command file_name
)
add_custom_command
(
OUTPUT
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
file_name
}
"
COMMAND
${
CMAKE_COMMAND
}
ARGS -E copy
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
file_name
}
"
"
${
file_name
}
"
DEPENDS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
file_name
}
"
)
endmacro
(
dune_add_copy_command file_name
)
# This macro adds a file-copy target under given target_name.
# The file_name is the name of a file that exists
# in the source tree. This file will be copied
# to the build tree.
macro
(
dune_add_copy_target target_name file_name
)
dune_add_copy_command
(
${
file_name
}
)
add_custom_target
(
"
${
target_name
}
"
ALL DEPENDS
"
${
file_name
}
"
)
endmacro
(
dune_fufem_add_copy_target target_name file_name
)
# This macro adds a copy-dependecy to a target
# The file_name is the name of a file that exists
# in the source tree. This file will be copied
# to the build tree.
macro
(
dune_add_copy_dependency target file_name
)
message
(
STATUS
"Adding copy-to-build-dir dependency for
${
file_name
}
to target
${
target
}
"
)
dune_add_copy_target
(
"
${
target
}
_copy_
${
file_name
}
"
"
${
file_name
}
"
)
add_dependencies
(
${
target
}
"
${
target
}
_copy_
${
file_name
}
"
)
endmacro
(
dune_add_copy_dependency
)
# add a symlink called src_dir to all directories in the build tree.
# That symlink points to the corresponding directory in the source tree.
# Call the macro from the toplevel CMakeLists.txt file of your project.
...
...
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