2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-09 14:50:58 +00:00
qpdf/cmake/qpdfCheckFlag.cmake
2022-03-18 19:53:18 -04:00

22 lines
561 B
CMake

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()