2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-10-31 19:02:30 +00:00
qpdf/cmake/qpdfCheckFlag.cmake

22 lines
561 B
CMake
Raw Normal View History

2022-03-05 13:24:51 +00:00
include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
function(qpdf_maybe_add_flag lang flag var)
if(${lang} STREQUAL "C")
check_c_compiler_flag(${flag} ${var})
elseif(${lang} STREQUAL "CXX")
check_cxx_compiler_flag(${flag} ${var})
endif()
if(${var})
message(STATUS "Using ${flag}: YES")
if(${lang} STREQUAL "C")
# Add for C and C++
add_compile_options(${flag})
else()
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:${flag}>)
endif()
else()
message(STATUS "Using ${flag}: NO")
endif()
endfunction()