aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-03-05 14:24:51 +0100
committerJay Berkenbilt <jberkenbilt@users.noreply.github.com>2022-03-19 00:53:18 +0100
commitb8aff90997116a84350018f88f1eabdaa368d11b (patch)
tree5ee781b03d3ffa81bfdd813e91f6324a75b266e6 /cmake
parent105862da3ea72c6763c26038d2e02cf243eb0798 (diff)
downloadqpdf-b8aff90997116a84350018f88f1eabdaa368d11b.tar.zst
Add cmake configuration files
Diffstat (limited to 'cmake')
-rw-r--r--cmake/qpdfCheckFlag.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/cmake/qpdfCheckFlag.cmake b/cmake/qpdfCheckFlag.cmake
new file mode 100644
index 00000000..8bd72b88
--- /dev/null
+++ b/cmake/qpdfCheckFlag.cmake
@@ -0,0 +1,21 @@
+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()