Merge lp://staging/~greg-hellings/sword/cmake-work into lp://staging/~sword-devel/sword/trunk

Proposed by Greg Hellings
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
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.

To post a comment you must log in.
2539. By Greg Hellings

This should fix the problem of CXX not getting the right flags.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Yes, this works great =)

14 IF(SWORD_ENABLE_WARNINGS STREQUAL "Yes")
15 - SET(SWORD_CFLAGS "${SWORD_CFLAGS} -Werror")
16 + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
17 ENDIF(SWORD_ENABLE_WARNINGS STREQUAL "Yes")

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.

review: Approve
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")

Copy-paste error =)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches