|
@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.0)
|
|
project(open62541)
|
|
project(open62541)
|
|
# set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
# set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
|
|
|
|
|
|
+string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER_CASE)
|
|
|
|
+
|
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake")
|
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake")
|
|
find_package(PythonInterp REQUIRED)
|
|
find_package(PythonInterp REQUIRED)
|
|
find_package(Git)
|
|
find_package(Git)
|
|
@@ -398,12 +400,14 @@ if(NOT UA_COMPILE_AS_CXX AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID
|
|
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default
|
|
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default
|
|
|
|
|
|
# Debug
|
|
# Debug
|
|
- if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
|
|
+ if(BUILD_TYPE_LOWER_CASE STREQUAL "debug")
|
|
if ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang")
|
|
if ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang")
|
|
# Add default sanitizer settings when using clang and Debug build.
|
|
# Add default sanitizer settings when using clang and Debug build.
|
|
# This allows e.g. CLion to find memory locations for SegFaults
|
|
# This allows e.g. CLion to find memory locations for SegFaults
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-coverage=trace-pc-guard,trace-cmp")
|
|
|
|
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-coverage=trace-pc-guard,trace-cmp")
|
|
|
|
|
|
+ message("Sanitizer enabled")
|
|
|
|
+ set(SANITIZER_FLAGS "-g -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-coverage=trace-pc-guard,trace-cmp -fsanitize=leak -fsanitize=undefined")
|
|
|
|
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}")
|
|
|
|
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}")
|
|
endif()
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
|