Date: Tue, 8 Jun 2010 22:17:27 GMT From: Rene Ladan <rene@FreeBSD.org> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/147703: devel/cmake: better handle thread flags Message-ID: <201006082217.o58MHRlo072245@www.freebsd.org> Resent-Message-ID: <201006082220.o58MK8UX068868@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 147703 >Category: ports >Synopsis: devel/cmake: better handle thread flags >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Jun 08 22:20:07 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Rene Ladan >Release: FreeBSD 8.1-BETA1 >Organization: >Environment: FreeBSD acer.rene-ladan.nl 8.1-BETA1 FreeBSD 8.1-BETA1 #0: Thu May 27 15:03:30 UTC 2010 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: Currently devel/cmake doesn't properly handle the case where thread flags are emitted, for example by wxgtk28-config from x11-toolkits/wxgtk28 . The resulting output in build/CMakeFiles/*/flags.make and build/CMakeFiles/*/link.txt contains -pthread;-D_THREAD_SAFE which confuses the shell. The patch removes all instances of -pthread; from CXX_FLAGS in the resulting flags.make . It leaves -D_THREAD_SAFE in the resulting link.txt, but in an unharmful way. >How-To-Repeat: Create hello.cpp and CMakeLists.txt in a new directory: % cat hello.cpp int main(int argc, char **argv) { return 0; } % cat CMakeLists.txt cmake_minimum_required(VERSION 2.4.6) find_package(wxWidgets REQUIRED) include(${wxWidgets_USE_FILE}) include_directories(${wxWidgets_INCLUDE_DIRS}) add_executable(hello hello.cpp) target_link_libraries(hello ${wxWidgets_LIBRARIES}) The resulting CMakeFiles/hello.dir/link.txt and CMakeFiles/hello.dir/flags.make will contain spurious semicolons. >Fix: Admittedly, not the best fix, but good enough to work (attached). Patch attached with submission follows: diff -ruN cmake.orig/Makefile cmake/Makefile --- cmake.orig/Makefile 2010-05-18 00:47:59.000000000 +0200 +++ cmake/Makefile 2010-06-09 00:16:10.000000000 +0200 @@ -7,7 +7,7 @@ PORTNAME= cmake PORTVERSION= 2.8.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= http://www.cmake.org/files/v${PORTVERSION:C/\.[[:digit:]]+$//}/ diff -ruN cmake.orig/files/patch-Modules_FindwxWidgets.cmake cmake/files/patch-Modules_FindwxWidgets.cmake --- cmake.orig/files/patch-Modules_FindwxWidgets.cmake 1970-01-01 01:00:00.000000000 +0100 +++ cmake/files/patch-Modules_FindwxWidgets.cmake 2010-06-08 23:46:00.000000000 +0200 @@ -0,0 +1,13 @@ +--- Modules/FindwxWidgets.cmake.orig 2010-06-08 23:44:09.000000000 +0200 ++++ Modules/FindwxWidgets.cmake 2010-06-08 23:45:06.000000000 +0200 +@@ -723,6 +723,10 @@ + STRING(REPLACE "-D" "" + wxWidgets_DEFINITIONS "${wxWidgets_DEFINITIONS}") + ++ # remove -pthread; from cxxflags, it is also in libs ++ STRING(REPLACE "-pthread;" "" ++ wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}") ++ + # parse include dirs from cxxflags; drop -I prefix + STRING(REGEX MATCHALL "-I[^;]+" + wxWidgets_INCLUDE_DIRS "${wxWidgets_CXX_FLAGS}") >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006082217.o58MHRlo072245>