sigc++.pc.in: Set -DLIBSIGCXX_STATIC in cxxflags as needed
authorChun-wei Fan <[email protected]>
Mon, 26 Jun 2023 04:22:27 +0000 (26 12:22 +0800)
committerKjell Ahlstedt <[email protected]>
Mon, 26 Jun 2023 09:10:11 +0000 (26 11:10 +0200)
Update the Meson build files to put in -DLIBSIGCXX_STATIC when we are building
a static build of libsigc++.

For the CMake and autotools build, this is not used.

CMakeLists.txt
configure.ac
meson.build
sigc++.pc.in

index 5741400..c4b291c 100644 (file)
@@ -23,6 +23,7 @@ set (SIGCXX_MICRO_VERSION 0)
 set (SIGCXX_API_VERSION 3.0)
 set (PACKAGE_VERSION ${SIGCXX_MAJOR_VERSION}.${SIGCXX_MINOR_VERSION}.${SIGCXX_MICRO_VERSION})
 set (LIBSIGCPP_SOVERSION 0)
+set (MSVC_STATIC_CXXFLAG "")
 
 option (SIGCXX_DISABLE_DEPRECATED "Disable deprecated" OFF)
 
index 2256657..52237da 100644 (file)
@@ -73,6 +73,8 @@ AS_IF([test "x$enable_benchmark" = xyes],[
   AX_BOOST_TIMER
 ])
 
+AC_SUBST(MSVC_STATIC_CXXFLAG, '')
+
 AC_CONFIG_FILES([Makefile
                  ${SIGCXX_MODULE_NAME}.pc:sigc++.pc.in
                  ${SIGCXX_MODULE_NAME}-uninstalled.pc:sigc++-uninstalled.pc.in
index 4777ed5..4c975d4 100644 (file)
@@ -193,6 +193,7 @@ add_project_arguments(warning_flags, language: 'cpp')
 
 # MSVC: Ignore warnings that aren't really harmful, but make those
 #       that should not be overlooked stand out.
+static_cxxflag = '-DLIBSIGCXX_STATIC'
 if is_msvc
   disable_warnings_list = [
     '/EHsc',  # avoid warnings caused by exception handling model used
@@ -217,7 +218,7 @@ if is_msvc
     language: 'cpp'
   )
   if is_msvc_static
-    add_project_arguments(['-DLIBSIGCXX_STATIC'], language: 'cpp')
+    add_project_arguments(static_cxxflag, language: 'cpp')
   endif
 endif
 
@@ -239,6 +240,7 @@ endif
 pkg_conf_data.set('SIGCXX_MAJOR_VERSION', sigcxx_major_version)
 pkg_conf_data.set('SIGCXX_MINOR_VERSION', sigcxx_minor_version)
 pkg_conf_data.set('SIGCXX_MICRO_VERSION', sigcxx_micro_version)
+pkg_conf_data.set('MSVC_STATIC_CXXFLAG', is_msvc_static ? static_cxxflag : '')
 
 configure_file(
   input: 'sigc++.pc.in',
index 16a5514..e162f2f 100644 (file)
@@ -15,4 +15,4 @@ Description: Typesafe signal and callback system for C++
 Version: @PACKAGE_VERSION@
 URL: https://libsigcplusplus.github.io/libsigcplusplus/
 Libs: -L${libdir} -lsigc-@SIGCXX_API_VERSION@
-Cflags: -I${includedir}/sigc++-@SIGCXX_API_VERSION@ -I${libdir}/sigc++-@SIGCXX_API_VERSION@/include
+Cflags: -I${includedir}/sigc++-@SIGCXX_API_VERSION@ -I${libdir}/sigc++-@SIGCXX_API_VERSION@/include @MSVC_STATIC_CXXFLAG@