diff options
| author | Bryce Harrington <bryce@bryceharrington.org> | 2016-02-27 09:25:50 +0000 |
|---|---|---|
| committer | bryce <bryce@bryceharrington.org> | 2016-02-27 09:25:50 +0000 |
| commit | 53a4d10251bb079fa22ced4dcbb381f42f56ceb1 (patch) | |
| tree | 364b09b8902cdeaa0fa6d41b40d4833b2a4f3dfe | |
| parent | inkview: Drop use of obsolete getopt (diff) | |
| download | inkscape-53a4d10251bb079fa22ced4dcbb381f42f56ceb1.tar.gz inkscape-53a4d10251bb079fa22ced4dcbb381f42f56ceb1.zip | |
cmake: Add sigc++ support
Patch from rindolf
Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
(bzr r14669)
| -rw-r--r-- | CMakeScripts/DefineDependsandFlags.cmake | 1 | ||||
| -rw-r--r-- | CMakeScripts/Modules/FindSigC++.cmake | 22 | ||||
| -rw-r--r-- | CMakeScripts/Modules/sigcpp_test.cpp | 15 |
3 files changed, 37 insertions, 1 deletions
diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake index 59c2cb063..ab197a7af 100644 --- a/CMakeScripts/DefineDependsandFlags.cmake +++ b/CMakeScripts/DefineDependsandFlags.cmake @@ -411,6 +411,7 @@ if(WITH_NLS) endif(GETTEXT_FOUND) endif(WITH_NLS) +find_package(SigC++ REQUIRED) # end Dependencies diff --git a/CMakeScripts/Modules/FindSigC++.cmake b/CMakeScripts/Modules/FindSigC++.cmake index ed0abc545..8046410b5 100644 --- a/CMakeScripts/Modules/FindSigC++.cmake +++ b/CMakeScripts/Modules/FindSigC++.cmake @@ -13,7 +13,6 @@ # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # - if (SIGC++_LIBRARIES AND SIGC++_INCLUDE_DIRS) # in cache already set(SIGC++_FOUND TRUE) @@ -103,4 +102,25 @@ else (SIGC++_LIBRARIES AND SIGC++_INCLUDE_DIRS) endif (SIGC++_LIBRARIES AND SIGC++_INCLUDE_DIRS) +# Try to add -std=c++11 if needed - see: +# https://bugs.launchpad.net/inkscape/+bug/1488079 + +macro (sigcpp_compile extra_cppflags) + try_compile(SIGCPP_COMPILES_FINE "${CMAKE_BINARY_DIR}/sigcpp-bindir" + SOURCES "${CMAKE_SOURCE_DIR}/CMakeScripts/Modules/sigcpp_test.cpp" + COMPILE_DEFINITIONS ${_SIGC++_CFLAGS} ${extra_cppflags} + LINK_LIBRARIES ${SIGC++_LIBRARIES}) +endmacro() + + +sigcpp_compile("") +if (NOT "${SIGCPP_COMPILES_FINE}") + set (cppflag "-std=c++11") + sigcpp_compile("${cppflag}") + if ("${SIGCPP_COMPILES_FINE}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cppflag}") + else() + message(FATAL_ERROR "Could not compile against SIGC++") + endif() +endif() diff --git a/CMakeScripts/Modules/sigcpp_test.cpp b/CMakeScripts/Modules/sigcpp_test.cpp new file mode 100644 index 000000000..b4cf2c773 --- /dev/null +++ b/CMakeScripts/Modules/sigcpp_test.cpp @@ -0,0 +1,15 @@ +/* + * Building this using: + + g++ `pkg-config --cflags sigc++-2.0` sigcpp_test.cpp + + Results in an error. + * */ +#include <stddef.h> +#include <string> +#include <sigc++/signal.h> + +int main() +{ + return 0; +} |
