Skip to content

Commit

Permalink
Test _MSVC_LANG instead of __cplusplus for CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
iguessthislldo committed May 6, 2024
1 parent a9d17f1 commit 9a218e9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 0 additions & 5 deletions cmake/init.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,10 @@ function(_opendds_set_cxx_std)
# Get the latest known default compiler C++ standard
set(default_cxx_std_year 1998)
foreach(cplusplus IN LISTS cplusplus_values)
set(args)
if(MSVC AND NOT MSVC_VERSION LESS 1914)
list(APPEND args CMAKE_FLAGS "-DCMAKE_CXX_FLAGS=/Zc:__cplusplus")
endif()
try_compile(compiled
"${temp_dir}/cplusplus_${cplusplus}"
SOURCES "${test_cxx_std}"
COMPILE_DEFINITIONS "-DOPENDDS_TEST_CPLUSPLUS=${cplusplus}L"
${args}
)
if(compiled)
_opendds_cplusplus_to_year(default_cxx_std_year ${cplusplus})
Expand Down
6 changes: 5 additions & 1 deletion cmake/test_cxx_std.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#ifdef OPENDDS_TEST_CPLUSPLUS
# if __cplusplus < OPENDDS_TEST_CPLUSPLUS
# ifdef _MSVC_LANG
# if _MSVC_LANG < OPENDDS_TEST_CPLUSPLUS
# error "Less then requested value"
# endif
# elif __cplusplus < OPENDDS_TEST_CPLUSPLUS
# error "Less then requested value"
# endif
#elif defined OPENDDS_TEST_ACE_CXX_STD
Expand Down
9 changes: 7 additions & 2 deletions docs/news.d/cmake-ace-tao-cpp-std.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.. news-prs: 4618
.. news-start-section: Platform Support and Dependencies
- Fix cases where the CMake support fails when using the ACE/TAO master branch because it now requires C++17.
.. news-end-section. news-end-section
.. news-start-section: CMake
- Allow using the ACE/TAO master branch which now requires C++17.
.. news-end-section
.. news-start-section: Building with CMake
- Visual Studio now defaults to using at least C++11 with ACE 6/TAO 2 instead of C++03.
.. news-end-section
.. news-end-section

0 comments on commit 9a218e9

Please sign in to comment.