diff options
author | Yuri Gorshenin <y@maps.me> | 2017-03-30 16:15:27 +0300 |
---|---|---|
committer | Sergey Yershov <syershov@maps.me> | 2017-03-30 16:47:09 +0300 |
commit | 363dbb83efef90121a6e442a83be7fe23d1087e9 (patch) | |
tree | ef870e153ca65f33514769589d0fca76022523dd | |
parent | 2b4eb56143d4a7cf6293c00cca61ac85e3881e5d (diff) |
-rw-r--r-- | CMakeLists.txt | 21 | ||||
-rw-r--r-- | drape/drape_tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | generator/generator_tool/CMakeLists.txt | 2 | ||||
-rw-r--r-- | openlr/openlr_stat/CMakeLists.txt | 2 | ||||
-rw-r--r-- | qt/CMakeLists.txt | 2 | ||||
-rw-r--r-- | routing/routing_consistency_tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | search/search_quality/assessment_tool/CMakeLists.txt | 2 | ||||
-rw-r--r-- | search/search_quality/features_collector_tool/CMakeLists.txt | 2 | ||||
-rw-r--r-- | search/search_quality/search_quality_tool/CMakeLists.txt | 2 |
9 files changed, 28 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 933cb5908f..acd66e4128 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.2) project(omim C CXX) +option(USE_ASAN "Enable Address Sanitizer" OFF) + +if (USE_ASAN) + message("Address Sanitizer is enabled") +endif() + set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Set environment variables @@ -134,10 +140,16 @@ include_directories( ) # Functions for using in subdirectories +function(omim_add_executable executable) + add_executable(${executable} ${ARGN}) + if (USE_ASAN) + target_link_libraries(${executable} "-fsanitize=address" "-fno-omit-frame-pointer") + endif() +endfunction() function(omim_add_test executable) if (NOT SKIP_TESTS) - add_executable(${executable} ${OMIM_ROOT}/testing/testingmain.cpp ${ARGN}) + omim_add_executable(${executable} ${OMIM_ROOT}/testing/testingmain.cpp ${ARGN}) endif() endfunction() @@ -246,6 +258,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") ) endif() +if (USE_ASAN) + add_compile_options( + "-fsanitize=address" + "-fno-omit-frame-pointer" + ) +endif() + add_subdirectory(3party/stb_image) add_subdirectory(3party/sdf_image) add_subdirectory(3party/protobuf) diff --git a/drape/drape_tests/CMakeLists.txt b/drape/drape_tests/CMakeLists.txt index 35220e99d2..2109fc8798 100644 --- a/drape/drape_tests/CMakeLists.txt +++ b/drape/drape_tests/CMakeLists.txt @@ -46,7 +46,7 @@ set( uniform_value_tests.cpp ) -add_executable(${PROJECT_NAME} ${DRAPE_COMMON_SRC} ${SRC}) +omim_add_executable(${PROJECT_NAME} ${DRAPE_COMMON_SRC} ${SRC}) omim_link_libraries( ${PROJECT_NAME} diff --git a/generator/generator_tool/CMakeLists.txt b/generator/generator_tool/CMakeLists.txt index d84a7b3032..d4d36fad73 100644 --- a/generator/generator_tool/CMakeLists.txt +++ b/generator/generator_tool/CMakeLists.txt @@ -4,7 +4,7 @@ include_directories(${OMIM_PATH}/3party/gflags/src) set(SRC generator_tool.cpp) -add_executable(${PROJECT_NAME} ${SRC}) +omim_add_executable(${PROJECT_NAME} ${SRC}) omim_link_libraries( ${PROJECT_NAME} diff --git a/openlr/openlr_stat/CMakeLists.txt b/openlr/openlr_stat/CMakeLists.txt index 2200d15376..34dcc61bff 100644 --- a/openlr/openlr_stat/CMakeLists.txt +++ b/openlr/openlr_stat/CMakeLists.txt @@ -7,7 +7,7 @@ set( openlr_stat.cpp ) -add_executable(${PROJECT_NAME} ${SRC}) +omim_add_executable(${PROJECT_NAME} ${SRC}) omim_link_libraries(${PROJECT_NAME} openlr routing diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt index 31c27fd0bb..41c7825547 100644 --- a/qt/CMakeLists.txt +++ b/qt/CMakeLists.txt @@ -50,7 +50,7 @@ set( update_dialog.hpp ) -add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${RES_SOURCES} ${SRC}) +omim_add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${RES_SOURCES} ${SRC}) omim_link_libraries( ${PROJECT_NAME} diff --git a/routing/routing_consistency_tests/CMakeLists.txt b/routing/routing_consistency_tests/CMakeLists.txt index c2a1535b61..4a35a13a72 100644 --- a/routing/routing_consistency_tests/CMakeLists.txt +++ b/routing/routing_consistency_tests/CMakeLists.txt @@ -12,7 +12,7 @@ set( ) # Not using omim_add_test because we don't need testingmain.cpp -add_executable(${PROJECT_NAME} ${SRC}) +omim_add_executable(${PROJECT_NAME} ${SRC}) omim_link_libraries( ${PROJECT_NAME} diff --git a/search/search_quality/assessment_tool/CMakeLists.txt b/search/search_quality/assessment_tool/CMakeLists.txt index 9eac1912f6..aee14f95d0 100644 --- a/search/search_quality/assessment_tool/CMakeLists.txt +++ b/search/search_quality/assessment_tool/CMakeLists.txt @@ -34,7 +34,7 @@ set( view.hpp ) -add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${SRC}) +omim_add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${SRC}) omim_link_libraries( ${PROJECT_NAME} diff --git a/search/search_quality/features_collector_tool/CMakeLists.txt b/search/search_quality/features_collector_tool/CMakeLists.txt index f03afc038d..988941748a 100644 --- a/search/search_quality/features_collector_tool/CMakeLists.txt +++ b/search/search_quality/features_collector_tool/CMakeLists.txt @@ -4,7 +4,7 @@ include_directories(${OMIM_ROOT}/3party/gflags/src) set(SRC features_collector_tool.cpp) -add_executable(${PROJECT_NAME} ${SRC}) +omim_add_executable(${PROJECT_NAME} ${SRC}) omim_link_libraries( ${PROJECT_NAME} diff --git a/search/search_quality/search_quality_tool/CMakeLists.txt b/search/search_quality/search_quality_tool/CMakeLists.txt index a7b3d90a05..c40d72fbc0 100644 --- a/search/search_quality/search_quality_tool/CMakeLists.txt +++ b/search/search_quality/search_quality_tool/CMakeLists.txt @@ -4,7 +4,7 @@ include_directories(${OMIM_ROOT}/3party/gflags/src) set(SRC search_quality_tool.cpp) -add_executable(${PROJECT_NAME} ${SRC}) +omim_add_executable(${PROJECT_NAME} ${SRC}) omim_link_libraries( ${PROJECT_NAME} |