Commit b7df599b authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #4871 make all compiler flag changes prepends so that user-specified...

refs #4871 make all compiler flag changes prepends so that user-specified flags (-D CMAKE_CXX_FLAGS="-foo") will take precedence


git-svn-id: file:///svn/toku/tokudb@48354 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4fb05bf0
...@@ -43,11 +43,11 @@ include(CheckCXXCompilerFlag) ...@@ -43,11 +43,11 @@ include(CheckCXXCompilerFlag)
macro(set_cflags_if_supported_named flag flagname) macro(set_cflags_if_supported_named flag flagname)
check_c_compiler_flag("${flag}" HAVE_C_${flagname}) check_c_compiler_flag("${flag}" HAVE_C_${flagname})
if (HAVE_C_${flagname}) if (HAVE_C_${flagname})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}") set(CMAKE_C_FLAGS "${flag} ${CMAKE_C_FLAGS}")
endif () endif ()
check_cxx_compiler_flag("${flag}" HAVE_CXX_${flagname}) check_cxx_compiler_flag("${flag}" HAVE_CXX_${flagname})
if (HAVE_CXX_${flagname}) if (HAVE_CXX_${flagname})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") set(CMAKE_CXX_FLAGS "${flag} ${CMAKE_CXX_FLAGS}")
endif () endif ()
endmacro(set_cflags_if_supported_named) endmacro(set_cflags_if_supported_named)
...@@ -56,11 +56,11 @@ macro(set_cflags_if_supported) ...@@ -56,11 +56,11 @@ macro(set_cflags_if_supported)
foreach(flag ${ARGN}) foreach(flag ${ARGN})
check_c_compiler_flag(${flag} HAVE_C_${flag}) check_c_compiler_flag(${flag} HAVE_C_${flag})
if (HAVE_C_${flag}) if (HAVE_C_${flag})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}") set(CMAKE_C_FLAGS "${flag} ${CMAKE_C_FLAGS}")
endif () endif ()
check_cxx_compiler_flag(${flag} HAVE_CXX_${flag}) check_cxx_compiler_flag(${flag} HAVE_CXX_${flag})
if (HAVE_CXX_${flag}) if (HAVE_CXX_${flag})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") set(CMAKE_CXX_FLAGS "${flag} ${CMAKE_CXX_FLAGS}")
endif () endif ()
endforeach(flag) endforeach(flag)
endmacro(set_cflags_if_supported) endmacro(set_cflags_if_supported)
...@@ -70,8 +70,8 @@ macro(set_ldflags_if_supported) ...@@ -70,8 +70,8 @@ macro(set_ldflags_if_supported)
foreach(flag ${ARGN}) foreach(flag ${ARGN})
check_cxx_compiler_flag(${flag} HAVE_${flag}) check_cxx_compiler_flag(${flag} HAVE_${flag})
if (HAVE_${flag}) if (HAVE_${flag})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}") set(CMAKE_EXE_LINKER_FLAGS "${flag} ${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${flag}") set(CMAKE_SHARED_LINKER_FLAGS "${flag} ${CMAKE_SHARED_LINKER_FLAGS}")
endif () endif ()
endforeach(flag) endforeach(flag)
endmacro(set_ldflags_if_supported) endmacro(set_ldflags_if_supported)
...@@ -118,8 +118,8 @@ else () ...@@ -118,8 +118,8 @@ else ()
# we overwrite this because the default passes -DNDEBUG and we don't want that # we overwrite this because the default passes -DNDEBUG and we don't want that
set(CMAKE_C_FLAGS_RELEASE "-g -O3 -flto -fuse-linker-plugin") set(CMAKE_C_FLAGS_RELEASE "-g -O3 -flto -fuse-linker-plugin")
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 -flto -fuse-linker-plugin") set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 -flto -fuse-linker-plugin")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g -fuse-linker-plugin") set(CMAKE_EXE_LINKER_FLAGS "-g -fuse-linker-plugin ${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -g -fuse-linker-plugin") set(CMAKE_SHARED_LINKER_FLAGS "-g -fuse-linker-plugin ${CMAKE_SHARED_LINKER_FLAGS}")
endif () endif ()
option(USE_VALGRIND "Do not pass NVALGRIND to the compiler, because valgrind will be run on the generated executables." ON) option(USE_VALGRIND "Do not pass NVALGRIND to the compiler, because valgrind will be run on the generated executables." ON)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment