tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
why does devel/cmake's Makefile subst's out compiler optimization?
hi-
cmake supports different "build types" that control compiler
optimization settings and debugging symbol generation. the four
standard build types are: Release, Debug, RelWithDebInfo, and
MinSizeRel which are supposed to correspond to:
# /tmp/cmake/bin/cmake --system-information | fgrep CMAKE_C_FLAGS_ | fgrep ==
CMAKE_C_FLAGS_DEBUG == "-g"
CMAKE_C_FLAGS_MINSIZEREL == "-Os -DNDEBUG"
CMAKE_C_FLAGS_RELEASE == "-O3 -DNDEBUG"
CMAKE_C_FLAGS_RELWITHDEBINFO == "-O2 -g -DNDEBUG"
#
unfortunately, a cmake compiled with pkgsrc breaks this (note
that all "-O"'s are filtered out):
# /pkg/bin/cmake --system-information | fgrep CMAKE_C_FLAGS_ | fgrep ==
CMAKE_C_FLAGS_DEBUG == "-g"
CMAKE_C_FLAGS_MINSIZEREL == "-DNDEBUG"
CMAKE_C_FLAGS_RELEASE == "-DNDEBUG"
CMAKE_C_FLAGS_RELWITHDEBINFO == "-g -DNDEBUG"
#
so if you do a -DCMAKE_BUILD_TYPE=Release you don't actually get
any compiler optimization turned on.
I traced this problem down to the pkgsrc Makefile where it does this:
SUBST_CLASSES+= flags
SUBST_STAGE.flags= pre-configure
SUBST_MESSAGE.flags= Fixing compiler flags.
SUBST_FILES.flags= Modules/Compiler/*.cmake
SUBST_SED.flags= -e 's,-O.,,'
but I don't understand what problem this is trying to fix.
when subst.mk edits the file "work/cmake-3.10.3/Modules/Compiler/GNU.cmake"
that modified GNU.cmake later gets installed in the pkgsrc prefix
directory and changes the expected semantics of CMAKE_BUILD_TYPE
for anything built with a pkgsrc generated cmake. this seems wrong?
chuck
Home |
Main Index |
Thread Index |
Old Index