diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in index a58069321a7..e065a8c2e62 100644 --- a/cmake/config.cmake.in +++ b/cmake/config.cmake.in @@ -1,5 +1,7 @@ set(_OPENDDS_CMAKE_BUILT_AND_INSTALLED TRUE) set(OPENDDS_USE_PREFIX_PATH TRUE) set(OPENDDS_INSTALL_LIB @CMAKE_INSTALL_LIBDIR@) +set(OPENDDS_CXX_STD @OPENDDS_CXX_STD@) +set(OPENDDS_CXX_STD_YEAR @OPENDDS_CXX_STD_YEAR@) @opendds_feature_vars@ diff --git a/configure b/configure index e55759adacc..16d5aff4916 100755 --- a/configure +++ b/configure @@ -396,6 +396,12 @@ my $debug = exists $opts{'debug'} ? $opts{'debug'} : 1; my $backup = exists $opts{'backup'} ? $opts{'backup'} : 1; my $force_ace_tao = exists $opts{'force-ace-tao'} ? $opts{'force-ace-tao'} : 0; my $no_disable_deprecated = exists $opts{'no-disable-deprecated'} ? $opts{'no-disable-deprecated'} : 0; +my $cxx_std; +if (exists($opts{'std'})) { + $cxx_std = $opts{'std'}; + # Accept any of --std=17, --std=stdcpp17, --std=c++17, etc. + $cxx_std =~ s/^(std)?(cpp|c\+\+)//; +} $opts{'host'} = perlOS_to_host() unless $opts{'host'}; @@ -736,12 +742,10 @@ EOF print "Visual C++ has >= C++11 support\n" if $opts{'verbose'}; } if ($opts{'std'}) { - # Accept any of --std=17, --std=stdcpp17, --std=c++17, etc. - $opts{'std'} =~ s/^(std)?(cpp|c\+\+)//; - my $prefix = 'stdcpp'; - push(@{$opts{'mpcopts'}}, "-value_template LanguageStandard=$prefix$opts{'std'}"); - print "Setting Visual C++ LanguageStandard to $prefix$opts{'std'}\n" if $opts{'verbose'}; - if ($opts{'std'} eq 'latest' || $opts{'std'} >= 17) { + my $std = "stdcpp$cxx_std"; + push(@{$opts{'mpcopts'}}, "-value_template LanguageStandard=$std"); + print "Setting Visual C++ LanguageStandard to $std\n" if $opts{'verbose'}; + if ($opts{'std'} eq 'latest' || $cxx_std >= 17) { push(@{$opts{'features'}}, 'no_cxx17=0'); print "Visual C++ has >= C++17 support\n" if $opts{'verbose'}; } @@ -2856,6 +2860,10 @@ sub write_cmake_file { print_cmake_config($fh, $config->{name}, $enabled); } + if (defined($cxx_std)) { + print_cmake_config($fh, 'OPENDDS_CXX_STD', $cxx_std); + } + # TODO(iguessthislldo): Move to a smarter system that can use existing # ACE/TAO and that works with cross compiling. print $fh "\n# Based on configure script options\n"; diff --git a/dds/DdsDcps.mpc b/dds/DdsDcps.mpc index e144e76be66..fda2efbad65 100644 --- a/dds/DdsDcps.mpc +++ b/dds/DdsDcps.mpc @@ -112,6 +112,7 @@ project(OpenDDS_Dcps): core, coverage_optional, \ " cp $(DDS_ROOT)/user_macros.GNU $(DESTDIR)$(INSTALL_PREFIX)/share/dds $(ACE_NUL_STDERR)" " @$(MKDIR) $(cmake_dir_install_dest)" " cp $(DDS_ROOT)/cmake/*.cmake $(cmake_dir_install_dest)" +" cp $(DDS_ROOT)/cmake/cplusplus.cpp $(cmake_dir_install_dest)" " cp $(DDS_ROOT)/cmake/export.h.in $(cmake_dir_install_dest)" " echo '' >> $(cmake_config_install_dest)" " echo '# From make install' >> $(cmake_config_install_dest)"