devel/cmake-core: Respect user CFLAGS/CXXFLAGS
CMake has set a few compiler optimization flags for ages, depending upon the build type. For Debug and Release build types, especially, these flags are overridden in Mk/Uses/cmake.mk for projects that use CMake, including other CMake components, i.e., devel/cmake-(doc|gui|man), but not cmake-core, since it has to bootstrap itself. This change makes the core component build with the same flags as the rest of the cmake ports. For most users, this just means that cmake-core will now build with -O2 instead of -O3 by default. Not bumping PORTREVISION since nobody has really cared about this for the past 15 years. To be clear, all other CFLAGS/CXXFLAGS have been respected. This just elimitates the -O3 flag that CMake internally adds for Release builds of cmake-core. Based upon work by former FreeBSD committer koobs. [1] [1] https://github.com/koobs/ports/commit/da342cfb3dd94f005e4a44d2ef9c863fc19b58e2 [1] Co-authored-by: Daniel Engberg <diizzy@FreeBSD.org> PR: 286494
This commit is contained in:
@@ -13,3 +13,14 @@ set(LibArchive_INCLUDE_DIR "/usr/include" CACHE PATH
|
||||
"Directory where LibArchive headers are located.")
|
||||
set(LibArchive_LIBRARY "/usr/lib/libarchive.so" CACHE PATH
|
||||
"LibArchive library to link against.")
|
||||
|
||||
# Respect user CFLAGS/CXXFLAGS for DEBUG and RELEASE builds as in
|
||||
# Mk/Uses/cmake.mk.
|
||||
set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING
|
||||
"Flags used by the C compiler during DEBUG builds.")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG" CACHE STRING
|
||||
"Flags used by the C compiler during RELEASE builds.")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING
|
||||
"Flags used by the CXX compiler during DEBUG builds.")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG" CACHE STRING
|
||||
"Flags used by the CXX compiler during RELEASE builds.")
|
||||
|
||||
Reference in New Issue
Block a user