Skip to content

Commit

Permalink
cmake: fix ENABLE_PROFILING
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Jul 3, 2020
1 parent 65dbbf7 commit 56b5a7d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmake/OpenCVCompilerOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,16 @@ if(CV_GCC OR CV_CLANG)

# Profiling?
if(ENABLE_PROFILING)
add_extra_compiler_option("-pg -g")
# turn off incompatible options
foreach(flags CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG
OPENCV_EXTRA_FLAGS_RELEASE OPENCV_EXTRA_FLAGS_DEBUG OPENCV_EXTRA_C_FLAGS OPENCV_EXTRA_CXX_FLAGS)
string(REPLACE "-fomit-frame-pointer" "" ${flags} "${${flags}}")
string(REPLACE "-ffunction-sections" "" ${flags} "${${flags}}")
string(REPLACE "-fdata-sections" "" ${flags} "${${flags}}")
endforeach()
# -pg should be placed both in the linker and in the compiler settings
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
add_extra_compiler_option("-pg -g")
else()
if(MSVC)
# TODO: Clang/C2 is not supported
Expand Down

0 comments on commit 56b5a7d

Please sign in to comment.