View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015087CMakeModulespublic2014-08-14 16:172015-11-02 09:13
ReporterRichard Shaw 
Assigned ToRichard Shaw 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformMSYS2/Mingw-w64OSWindowsOS Version7 32bit
Product VersionCMake 3.0.1 
Target VersionCMake 3.1Fixed in VersionCMake 3.1 
Summary0015087: Bug in FindwxWidgets.cmake causes build failure when more than one C flag is used.
DescriptionFindwxWidgets.cmake parses the output of wx-config and converts it to a list. The definitions and includes seem to be processed appropriately but whatever is left is considered a CXX flag.

If more than one flag remains it is left as a cmake list, i.e.:
"-mthreads;-fpermissive" which gcc chokes on.

On both my Fedora and Fedora mingw-w64 installs only one flag is used and the issue doesn't crop up.
Steps To ReproduceAttempt to build a cmake based project that uses wxWidgets with more than one build flag.
Additional InformationThe following patch worked for me but should be reviewed for appropriateness:

diff -Naur cmake-3.0.1.orig/Modules/FindwxWidgets.cmake cmake-3.0.1.wxfix/Modules/FindwxWidgets.cmake
--- cmake-3.0.1.orig/Modules/FindwxWidgets.cmake 2014-07-31 10:03:56.000000000 -0500
+++ cmake-3.0.1.wxfix/Modules/FindwxWidgets.cmake 2014-08-14 12:02:11.604331400 -0500
@@ -792,6 +792,10 @@
           wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}")
         string(REPLACE "-I" ""
           wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}")
+
+ # Flags are a string, not a list, fix it here
+ string(REPLACE ";" " "
+ wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}")

         DBG_MSG_V("wxWidgets_DEFINITIONS=${wxWidgets_DEFINITIONS}")
         DBG_MSG_V("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}")
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0036639)
Brad King (manager)
2014-08-18 16:34

The FindwxWidgets module only sets the value of wxWidgets_CXX_FLAGS. It is up to the project to use it correctly. If one uses the COMPILE_OPTIONS target property to apply the flags then a ;-list is the correct thing. I think this is a documentation issue because the docs do not say how the value is provided w.r.t. multiple flags. Existing projects may already expect a ;-list since that is what is now provided. Rather than changing this behavior, it should simply be documented.

Also the current call to separate_arguments(wxWidgets_CXX_FLAGS) just blindly replaces spaces with semicolons. That will not work with spaces in quoted paths. One needs to use the UNIX_COMMAND option to separate_arguments to get actual command-line parsing.
(0036640)
Richard Shaw (developer)
2014-08-18 17:01

Hmm... Since a use file is also implemented and recommended, perhaps the place to take care of it is there instead?

UsewxWidgets.cmake starting on line 90:

if (wxWidgets_CXX_FLAGS)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")
    MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
  endif()

So we could insert separate_arguments(...) before the set command above?
(0036641)
Richard Shaw (developer)
2014-08-18 17:22

Ok, sorry, I didn't catch what separate_arguments() did... That being the case, should my string(REPLACE...) code move to UsewxWidgets? It seem that there it is expected to be a string.
(0036643)
Brad King (manager)
2014-08-19 09:43

Re 0015087:0036640, 0015087:0036641: Oh, I forgot about UsewxWidgets. Yes, I think the flag fixup should move there.

Currently these modules have no maintainer:

 http://www.cmake.org/Wiki/CMake:Module_Maintainers [^]

Please let me know if you're interested in volunteering.
(0036648)
Richard Shaw (developer)
2014-08-19 12:58

Well I need more stuff to maintain like I need a hole in my head but I may be willing.

1. Read cmake-developer (DONE)
2. I've got the mantis bug tracker account obviously (DONE)
3. The link in the wiki for CDash is bad but I found the right place and registered and subscribed to the cmake dashboard. (DONE)
4. The link for the developers mailing list is bad, currently
"http://www.cmake.org/cgi-bin/mailman/listinfo/cmake-developers" [^] needs to be
"http://www.cmake.org/mailman/listinfo/cmake-developers" [^]
Signed up... I'll introduce myself later.

Looks like I need to be "invited" to complete the git part.
(0036649)
Brad King (manager)
2014-08-19 13:32

Re 0015087:0036648: I fixed the links in the Wiki. They were ancient versions of the URLs and it looks like a recent web server configuration update finally dropped the redirects.
(0036658)
Richard Shaw (developer)
2014-08-21 14:40

Ok, I just pushed a topic to the staging area. We'll see how it goes :)
(0038359)
oltolm (reporter)
2015-03-29 16:34

This was fixed in http://www.cmake.org/gitweb?p=cmake.git;a=commit;h=e6fa6e60f6330ddf60294a0d9a6ed4cb3f27d4c4 [^] . The commit was in CMake 3.0.2. Please close.
(0039752)
Robert Maynard (manager)
2015-11-02 09:13

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-08-14 16:17 Richard Shaw New Issue
2014-08-18 16:34 Brad King Note Added: 0036639
2014-08-18 17:01 Richard Shaw Note Added: 0036640
2014-08-18 17:22 Richard Shaw Note Added: 0036641
2014-08-19 09:43 Brad King Note Added: 0036643
2014-08-19 12:58 Richard Shaw Note Added: 0036648
2014-08-19 13:32 Brad King Note Added: 0036649
2014-08-20 09:48 Brad King Assigned To => Richard Shaw
2014-08-20 09:48 Brad King Status new => assigned
2014-08-21 14:40 Richard Shaw Note Added: 0036658
2015-03-29 16:34 oltolm Note Added: 0038359
2015-03-30 08:32 Brad King Status assigned => resolved
2015-03-30 08:32 Brad King Resolution open => fixed
2015-03-30 08:32 Brad King Fixed in Version => CMake 3.1
2015-03-30 08:32 Brad King Target Version => CMake 3.1
2015-11-02 09:13 Robert Maynard Note Added: 0039752
2015-11-02 09:13 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team