Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F27036826
HandleROSAOptions.cmake
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
HandleROSAOptions.cmake
View Options
# This CMake module is responsible for interpreting the user defined ROSA_
# options and executing the appropriate CMake commands to realize the users'
# selections.
include
(
CheckCCompilerFlag
)
include
(
CheckCXXCompilerFlag
)
if
(
CMAKE_COMPILER_IS_GNUCXX
)
set
(
ROSA_COMPILER_IS_GCC_COMPATIBLE
ON
)
elseif
(
MSVC
)
set
(
ROSA_COMPILER_IS_GCC_COMPATIBLE
OFF
)
elseif
(
"${CMAKE_CXX_COMPILER_ID}"
MATCHES
"Clang"
)
set
(
ROSA_COMPILER_IS_GCC_COMPATIBLE
ON
)
endif
()
function
(
append
value
)
foreach
(
variable
${
ARGN
}
)
set
(
${
variable
}
"${${variable}} ${value}"
PARENT_SCOPE
)
endforeach
(
variable
)
endfunction
()
function
(
append_if
condition
value
)
if
(
${
condition
}
)
foreach
(
variable
${
ARGN
}
)
set
(
${
variable
}
"${${variable}} ${value}"
PARENT_SCOPE
)
endforeach
(
variable
)
endif
()
endfunction
()
# NDEBUG on non-Debug builds
append
(
"-DNDEBUG"
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_MINSIZEREL
)
# Assertions are always enabled on Debug builds, this is interesting for
# non-Debug builds.
if
(
ROSA_ENABLE_ASSERTIONS
)
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
if
(
NOT
MSVC
)
add_definitions
(
-D_DEBUG
)
set
(
ENABLE_ASSERTIONS
"1"
)
else
()
set
(
ENABLE_ASSERTIONS
"0"
)
endif
()
# On non-Debug builds we NDEBUG, but in this case we need to undefine it:
add_definitions
(
-UNDEBUG
)
# Also remove /D NDEBUG to avoid MSVC warnings about conflicting defines.
foreach
(
flags_var_to_scrub
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_MINSIZEREL
)
string
(
REGEX
REPLACE
"(^| )[/-]D *NDEBUG($| )"
" "
"${flags_var_to_scrub}"
"${${flags_var_to_scrub}}"
)
endforeach
()
endif
(
ROSA_ENABLE_ASSERTIONS
)
#FIXME: Disable RTTI and exceptions, once gen_agent_test2 is cleared up.
if
(
ROSA_COMPILER_IS_GCC_COMPATIBLE
)
append
(
"-Wall -Wextra -Werror"
CMAKE_C_FLAGS
CMAKE_CXX_FLAGS
)
append_if
(
ROSA_ENABLE_PEDANTIC
"-pedantic -Wno-long-long"
CMAKE_C_FLAGS
CMAKE_CXX_FLAGS
)
check_cxx_compiler_flag
(
"-std=c++11"
CXX_SUPPORTS_CXX11
)
if
(
CXX_SUPPORTS_CXX11
)
append
(
"-std=c++11"
CMAKE_CXX_FLAGS
)
else
()
message
(
FATAL_ERROR
"RoSA requires C++11 support but the '-std=c++11' flag isn't supported."
)
endif
()
else
(
ROSA_COMPILER_IS_GCC_COMPATIBLE
)
# FIXME: set the same things as for GCC-compatible compilers
endif
(
ROSA_COMPILER_IS_GCC_COMPATIBLE
)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 27, 8:14 PM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
407650
Default Alt Text
HandleROSAOptions.cmake (2 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline