Merge lp://staging/~greg-hellings/sword/cmake-work into lp://staging/~sword-devel/sword/trunk
Status: | Merged |
---|---|
Merge reported by: | Dimitri John Ledkov |
Merged at revision: | not available |
Proposed branch: | lp://staging/~greg-hellings/sword/cmake-work |
Merge into: | lp://staging/~sword-devel/sword/trunk |
Diff against target: |
39 lines (+6/-19) 1 file modified
CMakeLists.txt (+6/-19) |
To merge this branch: | bzr merge lp://staging/~greg-hellings/sword/cmake-work |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Dimitri John Ledkov (community) | Approve | ||
Review via email: mp+42909@code.staging.launchpad.net |
Description of the change
This is the second half of the change you asked for - honoring environment CFlags and CXXFlags. However, it still leaves some control in the configurator's hands as well, which is the default behavior of CMake.
If you include an environment for CXXFLAGS you will see that the final value of compile flags for a C++ source is "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS} ${INCLUDE_DIRS}". The same goes for CFLAGS on C sources (though I don't think there are very many of them).
Let me know if this works for you. This also makes building on Mac or Windows easier, as this method honors the need to have different compile flags for different configurations (Debug, Release, MinSizeRel and RelWithDebug) simultaneously whereas my previous method restricted me to only one set of compile flags at once.
Yes, this works great =)
14 IF(SWORD_ ENABLE_ WARNINGS STREQUAL "Yes") ENABLE_ WARNINGS STREQUAL "Yes")
15 - SET(SWORD_CFLAGS "${SWORD_CFLAGS} -Werror")
16 + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
17 ENDIF(SWORD_
Should probably have inside if:
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror"
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror"
Apart from this, everything works wonderfully with / without build_type set and with / without *FLAGS set and during regular build / dpkg build / chroot build.