Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add --cxxflags and --shlibflags configure options #83

Closed
wants to merge 1 commit into from

2 participants

@jstasiak

Support for these options allows POCO to be easily built on OS X with C++11 enabled and as libc++ as stdib.

@jstasiak jstasiak referenced this pull request in Homebrew/homebrew
Closed

Add --with-c++11 switch to POCO formula #17750

@aleks-f
Owner

these can be passed through --cflags switch, which will end up in COMMONFLAGS. I know we can break it down but we should do all or none.

@jstasiak

Unfortunately --cflags works "globally" so after configuring POCO with ./configure --cflags="-std=c++11 -stdlib=libc++" build fails with multiple error: invalid argument '-std=c++11' not allowed with 'C/ObjC'. One example:

/Users/aa/projects/poco/build/script/makedepend.clang src/trees.c /Users/aa/projects/poco/Foundation/.dep/Darwin/x86_64/trees.d /Users/aa/projects/poco/Foundation/obj/Darwin/x86_64/debug_static /Users/aa/projects/poco/Foundation/obj/Darwin/x86_64/release_static /Users/aa/projects/poco/Foundation/obj/Darwin/x86_64/debug_shared /Users/aa/projects/poco/Foundation/obj/Darwin/x86_64/release_shared  -Iinclude -I/Users/aa/projects/poco/CppUnit/include -I/Users/aa/projects/poco/Foundation/include -I/Users/aa/projects/poco/XML/include -I/Users/aa/projects/poco/JSON/include -I/Users/aa/projects/poco/Util/include -I/Users/aa/projects/poco/Net/include -I/Users/aa/projects/poco/Crypto/include -I/Users/aa/projects/poco/NetSSL_OpenSSL/include -I/Users/aa/projects/poco/Data/include -I/Users/aa/projects/poco/Data/SQLite/include -I/Users/aa/projects/poco/Data/ODBC/include -I/Users/aa/projects/poco/Data/MySQL/include -I/Users/aa/projects/poco/Zip/include -I/Users/aa/projects/poco/PageCompiler/include -I/Users/aa/projects/poco/PageCompiler/File2Page/include -I/Users/aa/projects/poco/ApacheConnector/include -I/Users/aa/projects/poco/PDF/include -I/Users/aa/projects/poco/CppParser/include -I/Users/aa/projects/poco/PocoDoc/include -I/Users/aa/projects/poco/ProGen/include -I/Users/aa/projects/poco/MongoDB/include -arch x86_64 -DPOCO_BUILD_HOST=lorien -std=c++11 -stdlib=libc++ -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64 
error: invalid argument '-std=c++11' not allowed with 'C/ObjC'

This patch works for me and at the moment I cannot spend any more time improving this solution but I'm happy if someone else contributes.

@jstasiak

Actually now that I look at 9b5b2bc it looks like it's been fixed already. I'm gonna test if it works for me.

@jstasiak

Yeah, I can just do ./configure --config=Darwin-clang-libc++ which is fine.

@jstasiak jstasiak closed this
@jstasiak jstasiak deleted the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 11, 2013
  1. @jstasiak
This page is out of date. Refresh to see the latest.
Showing with 21 additions and 1 deletion.
  1. +3 −1 build/rules/global
  2. +18 −0 configure
View
4 build/rules/global
@@ -235,9 +235,11 @@ endif
#
COMMONFLAGS = -DPOCO_BUILD_HOST=$(HOSTNAME) $(POCO_FLAGS)
CFLAGS += $(COMMONFLAGS) $(SYSFLAGS)
-CXXFLAGS += $(COMMONFLAGS) $(SYSFLAGS)
+CXXFLAGS += $(COMMONFLAGS) $(POCO_CXX_FLAGS) $(SYSFLAGS)
LINKFLAGS += $(COMMONFLAGS) $(SYSFLAGS)
+SHLIBFLAGS += $(POCO_SHLIB_FLAGS)
+
ifeq ($(OSARCH_64BITS),1)
CFLAGS += $(CFLAGS64)
CXXFLAGS += $(CXXFLAGS64)
View
18 configure
@@ -83,6 +83,12 @@ Options:
Pass additional flags to compiler.
Example: --cflags=-wall
+ --cxxflags=<flags>
+ Pass additional flags to C++ compilter.
+
+ --shlibflags=<flags>
+ Pass additional flags for shared library generation.
+
--poquito
Omit a few features for smaller codesize when linking
statically for embedded targets.
@@ -114,6 +120,8 @@ cd $build
tests=1
samples=1
flags=""
+cxxflags=""
+shlibflags=""
omit=""
includepath=""
librarypath=""
@@ -152,6 +160,12 @@ while [ $# -ge 1 ]; do
--cflags=*)
flags="`echo ${1} | awk '{print substr($0,10)}'`" ;;
+ --cxxflags=*)
+ cxxflags="`echo ${1} | awk '{print substr($0,12)}'`" ;;
+
+ --shlibflags=*)
+ shlibflags="`echo ${1} | awk '{print substr($0,14)}'`" ;;
+
--no-samples)
samples="" ;;
@@ -251,6 +265,8 @@ echo "POCO_BASE = $base" >>$build/config.make
echo "POCO_BUILD = $build" >>$build/config.make
echo "POCO_PREFIX = $prefix" >>$build/config.make
echo "POCO_FLAGS = $flags" >>$build/config.make
+echo "POCO_CXX_FLAGS = $cxxflags" >>$build/config.make
+echo "POCO_SHLIB_FLAGS = $shlibflags" >>$build/config.make
echo "OMIT = $omit" >>$build/config.make
if [ -n "$stdcxx_base" ] ; then
echo "STDCXX_BASE = $stdcxx_base" >>$build/config.make
@@ -280,6 +296,8 @@ export POCO_BASE
export POCO_BUILD
export POCO_PREFIX
export POCO_FLAGS
+export POCO_CXX_FLAGS
+export POCO_SHLIB_FLAGS
__EOF__
if [ -n "$stdcxx_base" ] ; then
Something went wrong with that request. Please try again.