Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiph.Org
Opus
Commits
b83dd528
Commit
b83dd528
authored
4 years ago
by
Marcus Asteborg
Committed by
Ralph Giles
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
cmake - MINGW check for ssp lib and link if security features is enabled
parent
d4b8707b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Dev/cmakefixes7 12
Pipeline
#2098
passed
4 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+16
-6
16 additions, 6 deletions
CMakeLists.txt
cmake/OpusConfig.cmake
+12
-0
12 additions, 0 deletions
cmake/OpusConfig.cmake
with
28 additions
and
6 deletions
CMakeLists.txt
+
16
−
6
View file @
b83dd528
...
...
@@ -109,10 +109,19 @@ cmake_dependent_option(OPUS_STACK_PROTECTOR
OFF
)
add_feature_info
(
OPUS_STACK_PROTECTOR OPUS_STACK_PROTECTOR
${
OPUS_STACK_PROTECTOR_HELP_STR
}
)
if
(
NOT MSVC AND NOT MINGW
)
set
(
OPUS_FORTIFY_SOURCE_HELP_STR
"add protection against buffer overflows."
)
option
(
OPUS_FORTIFY_SOURCE
${
OPUS_FORTIFY_SOURCE_HELP_STR
}
ON
)
add_feature_info
(
OPUS_FORTIFY_SOURCE OPUS_FORTIFY_SOURCE
${
OPUS_FORTIFY_SOURCE_HELP_STR
}
)
if
(
NOT MSVC
)
set
(
OPUS_FORTIFY_SOURCE_HELP_STR
"add protection against buffer overflows."
)
cmake_dependent_option
(
OPUS_FORTIFY_SOURCE
${
OPUS_FORTIFY_SOURCE_HELP_STR
}
ON
"FORTIFY_SOURCE_SUPPORTED"
OFF
)
add_feature_info
(
OPUS_FORTIFY_SOURCE OPUS_FORTIFY_SOURCE
${
OPUS_FORTIFY_SOURCE_HELP_STR
}
)
endif
()
if
(
MINGW
AND
(
OPUS_FORTIFY_SOURCE OR OPUS_STACK_PROTECTOR
))
# ssp lib is needed for security features for MINGW
list
(
APPEND OPUS_REQUIRED_LIBRARIES ssp
)
endif
()
if
(
OPUS_CPU_X86 OR OPUS_CPU_X64
)
...
...
@@ -247,8 +256,9 @@ target_include_directories(
target_link_libraries
(
opus PRIVATE
${
OPUS_REQUIRED_LIBRARIES
}
)
target_compile_definitions
(
opus PRIVATE OPUS_BUILD ENABLE_HARDENING
)
if
(
OPUS_FORTIFY_SOURCE
)
target_compile_definitions
(
opus PRIVATE _FORTIFY_SOURCE=2
)
if
(
OPUS_FORTIFY_SOURCE AND NOT MSVC
)
target_compile_definitions
(
opus PRIVATE
$<$<NOT:$<CONFIG:debug>>:_FORTIFY_SOURCE=2>
)
endif
()
if
(
OPUS_FLOAT_APPROX
)
...
...
This diff is collapsed.
Click to expand it.
cmake/OpusConfig.cmake
+
12
−
0
View file @
b83dd528
...
...
@@ -77,6 +77,18 @@ else()
check_flag
(
FAST_MATH -ffast-math
)
check_flag
(
STACK_PROTECTOR -fstack-protector-strong
)
check_flag
(
HIDDEN_VISIBILITY -fvisibility=hidden
)
set
(
FORTIFY_SOURCE_SUPPORTED 1
)
endif
()
if
(
MINGW
)
# For MINGW we need to link ssp lib for security features such as
# stack protector and fortify_sources
check_library_exists
(
ssp __stack_chk_fail
""
HAVE_LIBSSP
)
if
(
NOT HAVE_LIBSSP
)
message
(
WARNING
"Could not find libssp in MinGW, disabling STACK_PROTECTOR and FORTIFY_SOURCE"
)
set
(
STACK_PROTECTOR_SUPPORTED 0
)
set
(
FORTIFY_SOURCE_SUPPORTED 0
)
endif
()
endif
()
if
(
NOT MSVC
)
...
...
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