Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Dmitri Naumov
ogs
Commits
a1b4a828
Verified
Commit
a1b4a828
authored
4 years ago
by
Lars Bilke
Browse files
Options
Downloads
Patches
Plain Diff
[cmake] Added function ogs_add_executable for proper warning levels.
parent
9c2e9615
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
scripts/cmake/Functions.cmake
+30
-4
30 additions, 4 deletions
scripts/cmake/Functions.cmake
with
30 additions
and
4 deletions
scripts/cmake/Functions.cmake
+
30
−
4
View file @
a1b4a828
...
...
@@ -12,9 +12,6 @@ macro(GET_SOURCE_FILES source_files)
file
(
GLOB GET_SOURCE_FILES_HEADERS RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
CONFIGURE_DEPENDS
${
DIR
}
/*.h
)
file
(
GLOB GET_SOURCE_FILES_TEMPLATES RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
CONFIGURE_DEPENDS
${
DIR
}
/*.tpp
)
file
(
GLOB GET_SOURCE_FILES_SOURCES RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
CONFIGURE_DEPENDS
${
DIR
}
/*.cpp
)
...
...
@@ -81,7 +78,7 @@ function(add_autogen_include target)
endif
()
endfunction
()
# Replacement for add_library() for ogs
target
s
# Replacement for add_library() for ogs
librarie
s
function
(
ogs_add_library targetName
)
set
(
options STATIC SHARED
)
cmake_parse_arguments
(
ogs_add_library
"
${
options
}
"
""
""
${
ARGN
}
)
...
...
@@ -132,6 +129,35 @@ function(ogs_add_library targetName)
GroupSourcesByFolder
(
${
targetName
}
)
endfunction
()
# Replacement for ogs_add_executable() for ogs executables
function
(
ogs_add_executable targetName
)
cmake_parse_arguments
(
ogs_add_executable
""
""
""
${
ARGN
}
)
foreach
(
file
${
ogs_add_executable_UNPARSED_ARGUMENTS
}
)
get_filename_component
(
file_path
${
file
}
REALPATH
)
list
(
APPEND files
${
file_path
}
)
endforeach
()
add_executable
(
${
targetName
}
${
files
}
)
target_compile_options
(
${
targetName
}
PRIVATE
# OR does not work with cotire
# $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,
# $<CXX_COMPILER_ID:GNU>>:-Wall -Wextra>
$<$<CXX_COMPILER_ID:Clang>:-Wall
-Wextra
-Wunreachable-code>
$<$<CXX_COMPILER_ID:AppleClang>:-Wall
-Wextra
-Wunreachable-code>
$<$<CXX_COMPILER_ID:GNU>:-Wall
-Wextra
-Wunreachable-code>
$<$<CXX_COMPILER_ID:MSVC>:/W3>
)
endfunction
()
# Parses current directory into a list
function
(
current_dir_as_list baseDir outList
)
file
(
RELATIVE_PATH REL_DIR
${
PROJECT_SOURCE_DIR
}
/
${
baseDir
}
...
...
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