diff --git a/Source/cmExportPackageInfoGenerator.cxx b/Source/cmExportPackageInfoGenerator.cxx index a30b0b030d..23f2b7284d 100644 --- a/Source/cmExportPackageInfoGenerator.cxx +++ b/Source/cmExportPackageInfoGenerator.cxx @@ -465,7 +465,7 @@ void cmExportPackageInfoGenerator::GenerateInterfaceCompileFeatures( for (auto const& value : cmList{ iter->second }) { if (cmHasLiteralPrefix(value, "c_std_")) { auto suffix = cm::string_view{ value }.substr(6, 2); - features.emplace(cmStrCat("cxx", suffix)); + features.emplace(cmStrCat("c", suffix)); } else if (cmHasLiteralPrefix(value, "cxx_std_")) { auto suffix = cm::string_view{ value }.substr(8, 2); features.emplace(cmStrCat("c++", suffix)); diff --git a/Tests/RunCMake/ExportPackageInfo/InterfaceProperties-check.cmake b/Tests/RunCMake/ExportPackageInfo/InterfaceProperties-check.cmake index fcec61ffe0..a93b676aa3 100644 --- a/Tests/RunCMake/ExportPackageInfo/InterfaceProperties-check.cmake +++ b/Tests/RunCMake/ExportPackageInfo/InterfaceProperties-check.cmake @@ -10,8 +10,9 @@ string(JSON component GET "${content}" "components" "foo") expect_value("${component}" "interface" "type") expect_array("${component}" 1 "includes") expect_value("${component}" "${CMAKE_CURRENT_LIST_DIR}/foo" "includes" 0) -expect_array("${component}" 1 "compile_features") +expect_array("${component}" 2 "compile_features") expect_value("${component}" "c++23" "compile_features" 0) +expect_value("${component}" "c17" "compile_features" 1) expect_array("${component}" 1 "compile_flags") expect_value("${component}" "-ffast-math" "compile_flags" 0) expect_null("${component}" "definitions" "*" "FOO") diff --git a/Tests/RunCMake/ExportPackageInfo/InterfaceProperties.cmake b/Tests/RunCMake/ExportPackageInfo/InterfaceProperties.cmake index 5e2f966821..038aa96afa 100644 --- a/Tests/RunCMake/ExportPackageInfo/InterfaceProperties.cmake +++ b/Tests/RunCMake/ExportPackageInfo/InterfaceProperties.cmake @@ -1,6 +1,6 @@ add_library(foo INTERFACE) -target_compile_features(foo INTERFACE cxx_std_23) +target_compile_features(foo INTERFACE c_std_17 cxx_std_23) target_compile_options(foo INTERFACE -ffast-math) target_compile_definitions(foo INTERFACE -DFOO -DBAR=BAR) target_include_directories( diff --git a/Tests/RunCMake/InstallPackageInfo/InterfaceProperties-check.cmake b/Tests/RunCMake/InstallPackageInfo/InterfaceProperties-check.cmake index 912ce6ba95..655212f593 100644 --- a/Tests/RunCMake/InstallPackageInfo/InterfaceProperties-check.cmake +++ b/Tests/RunCMake/InstallPackageInfo/InterfaceProperties-check.cmake @@ -10,8 +10,9 @@ string(JSON component GET "${content}" "components" "foo") expect_value("${component}" "interface" "type") expect_array("${component}" 1 "includes") expect_value("${component}" "@prefix@/include/foo" "includes" 0) -expect_array("${component}" 1 "compile_features") +expect_array("${component}" 2 "compile_features") expect_value("${component}" "c++23" "compile_features" 0) +expect_value("${component}" "c17" "compile_features" 1) expect_array("${component}" 1 "compile_flags") expect_value("${component}" "-ffast-math" "compile_flags" 0) expect_null("${component}" "definitions" "*" "FOO") diff --git a/Tests/RunCMake/InstallPackageInfo/InterfaceProperties.cmake b/Tests/RunCMake/InstallPackageInfo/InterfaceProperties.cmake index 58e5046672..240bff11fa 100644 --- a/Tests/RunCMake/InstallPackageInfo/InterfaceProperties.cmake +++ b/Tests/RunCMake/InstallPackageInfo/InterfaceProperties.cmake @@ -1,6 +1,6 @@ add_library(foo INTERFACE) -target_compile_features(foo INTERFACE cxx_std_23) +target_compile_features(foo INTERFACE c_std_17 cxx_std_23) target_compile_options(foo INTERFACE -ffast-math) target_compile_definitions(foo INTERFACE -DFOO -DBAR=BAR) target_include_directories(