Skip to content

Commit

Permalink
Set compiler.cstd in host profile
Browse files Browse the repository at this point in the history
The cstd setting was added to Conan in v2.4.0. Similar to cppstd, it is
used to indicate the selected C language standard.
  • Loading branch information
jhol committed Aug 14, 2024
1 parent c22bbf0 commit 2778c78
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion conan_provider.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

set(CONAN_MINIMUM_VERSION 2.0.5)
set(CONAN_MINIMUM_VERSION 2.4.0)

# Create a new policy scope and set the minimum required cmake version so the
# features behind a policy setting like if(... IN_LIST ...) behaves as expected
Expand Down Expand Up @@ -128,6 +128,14 @@ function(detect_arch arch)
endfunction()


function(detect_c_standard c_standard)
set(${c_standard} ${CMAKE_C_STANDARD} PARENT_SCOPE)
if(CMAKE_C_EXTENSIONS)
set(${c_standard} "gnu${CMAKE_C_STANDARD}" PARENT_SCOPE)
endif()
endfunction()


function(detect_cxx_standard cxx_standard)
set(${cxx_standard} ${CMAKE_CXX_STANDARD} PARENT_SCOPE)
if(CMAKE_CXX_EXTENSIONS)
Expand Down Expand Up @@ -363,6 +371,7 @@ function(detect_host_profile output_file)
detect_os(os os_api_level os_sdk os_subsystem os_version)
detect_arch(arch)
detect_compiler(compiler compiler_version compiler_runtime compiler_runtime_type)
detect_c_standard(compiler_cstd)
detect_cxx_standard(compiler_cppstd)
detect_lib_cxx(compiler_libcxx)
detect_build_type(build_type)
Expand Down Expand Up @@ -399,6 +408,9 @@ function(detect_host_profile output_file)
if(compiler_runtime_type)
string(APPEND profile compiler.runtime_type=${compiler_runtime_type} "\n")
endif()
if(compiler_cstd)
string(APPEND profile compiler.cstd=${compiler_cstd} "\n")
endif()
if(compiler_cppstd)
string(APPEND profile compiler.cppstd=${compiler_cppstd} "\n")
endif()
Expand Down

0 comments on commit 2778c78

Please sign in to comment.