From 9df188963e5980d305dd50d721978ccdd997a8c3 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Sun, 26 Apr 2020 18:42:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=B4=D1=83=D0=B1=D0=BB=D0=B8=D0=BA=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=20=D1=84=D0=BB=D0=B0=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibBuildTypes.cmake | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/CMLibBuildTypes.cmake b/CMLibBuildTypes.cmake index ed5b3e2..d437e80 100644 --- a/CMLibBuildTypes.cmake +++ b/CMLibBuildTypes.cmake @@ -24,14 +24,29 @@ endif() if(CMAKE_BUILD_TYPE STREQUAL Profile) # Ключи компиляции для режима профилирования в зависимости от типа компилятора if(CMAKE_CXX_COMPILER_IS_Clang OR CMAKE_CXX_COMPILER_IS_GCC) - set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE} -ggdb -pg -fno-omit-frame-pointer" CACHE STRING "" - FORCE) - set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} -ggdb -pg -fno-omit-frame-pointer" CACHE STRING - "" FORCE) - set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pg" CACHE STRING "" FORCE) - set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -pg" CACHE STRING "" FORCE) - set(CMAKE_STATIC_LINKER_FLAGS_PROFILE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -pg" CACHE STRING "" FORCE) - set(CMAKE_MODULE_LINKER_FLAGS_PROFILE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -pg" CACHE STRING "" FORCE) + set(CMAKE_C_FLAGS_PROFILE ${CMAKE_C_FLAGS_RELEASE} -ggdb -pg -fno-omit-frame-pointer) + list(REMOVE_DUPLICATES CMAKE_C_FLAGS_PROFILE) + set(CMAKE_C_FLAGS_PROFILE CACHE STRING "" FORCE) + + set(CMAKE_CXX_FLAGS_PROFILE ${CMAKE_CXX_FLAGS_RELEASE} -ggdb -pg -fno-omit-frame-pointer) + list(REMOVE_DUPLICATES CMAKE_CXX_FLAGS_PROFILE) + set(CMAKE_CXX_FLAGS_PROFILE CACHE STRING "" FORCE) + + set(CMAKE_EXE_LINKER_FLAGS_PROFILE ${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pg) + list(REMOVE_DUPLICATES CMAKE_EXE_LINKER_FLAGS_PROFILE) + set(CMAKE_EXE_LINKER_FLAGS_PROFILE CACHE STRING "" FORCE) + + set(CMAKE_SHARED_LINKER_FLAGS_PROFILE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -pg) + list(REMOVE_DUPLICATES CMAKE_SHARED_LINKER_FLAGS_PROFILE) + set(CMAKE_SHARED_LINKER_FLAGS_PROFILE CACHE STRING "" FORCE) + + set(CMAKE_STATIC_LINKER_FLAGS_PROFILE ${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -pg) + list(REMOVE_DUPLICATES CMAKE_STATIC_LINKER_FLAGS_PROFILE) + set(CMAKE_STATIC_LINKER_FLAGS_PROFILE CACHE STRING "" FORCE) + + set(CMAKE_MODULE_LINKER_FLAGS_PROFILE ${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -pg) + list(REMOVE_DUPLICATES CMAKE_MODULE_LINKER_FLAGS_PROFILE) + set(CMAKE_MODULE_LINKER_FLAGS_PROFILE CACHE STRING "" FORCE) elseif(CMAKE_CXX_COMPILER_IS_Intel) message("Set options for profiling with Intel C++") elseif(CMAKE_CXX_COMPILER_IS_MSVC) @@ -43,8 +58,13 @@ if(CMAKE_BUILD_TYPE STREQUAL Profile) elseif(CMAKE_BUILD_TYPE STREQUAL Debug) # В режиме отладки подробный вывод сообщений компилятора if(CMAKE_CXX_COMPILER_IS_Clang OR CMAKE_CXX_COMPILER_IS_GCC) - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -fno-omit-frame-pointer" CACHE STRING "" FORCE) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -fno-omit-frame-pointer" CACHE STRING "" FORCE) + set(CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG} -ggdb -fno-omit-frame-pointer) + list(REMOVE_DUPLICATES CMAKE_C_FLAGS_DEBUG) + set(CMAKE_C_FLAGS_DEBUG CACHE STRING "" FORCE) + + set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} -ggdb -fno-omit-frame-pointer) + list(REMOVE_DUPLICATES CMAKE_CXX_FLAGS_DEBUG) + set(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "" FORCE) endif() set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "Enable generation of verbose build scripts." FORCE) set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable generation of compile_commands.json." FORCE)