summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-09-10 04:06:30 -0700
committerGuy Harris <guy@alum.mit.edu>2017-09-10 04:06:30 -0700
commitc793042d8a8b284ca2bddad26c97aeaa1188e90e (patch)
treee2604a3b545d08db9fdcfe5476add08186d582c0 /cmake
parent57b81fcacd040e9ff1ccc05fbbe478aeb291f0f3 (diff)
downloadlibpcap-c793042d8a8b284ca2bddad26c97aeaa1188e90e.tar.gz
Use cmake_push_check_state() and cmake_pop_check_state().
That way, we don't change the CMAKE_REQUIRED_ values as a side-effect.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindLFS.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmake/FindLFS.cmake b/cmake/FindLFS.cmake
index 771b89f4..be5f0d48 100644
--- a/cmake/FindLFS.cmake
+++ b/cmake/FindLFS.cmake
@@ -32,6 +32,7 @@
include(CheckCSourceCompiles)
include(FindPackageHandleStandardArgs)
+include(CMakePushCheckState)
# Test program to check for LFS. Requires that off_t has at least 8 byte large
set(_lfs_test_source
@@ -47,6 +48,7 @@ set(_lfs_test_source
# This appends to the variables _lfs_cppflags, _lfs_cflags, and _lfs_ldflags,
# it also sets LFS_FOUND to 1 if it works.
function(_lfs_check_compiler_option var options definitions libraries)
+ cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET 1)
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} ${options})
set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${definitions})
@@ -54,6 +56,7 @@ function(_lfs_check_compiler_option var options definitions libraries)
message(STATUS "Looking for LFS support using ${options} ${definitions} ${libraries}")
check_c_source_compiles("${_lfs_test_source}" ${var})
+ cmake_pop_check_state()
if(${var})
message(STATUS "Looking for LFS support using ${options} ${definitions} ${libraries} - found")
@@ -79,9 +82,11 @@ function(_lfs_check)
set(_lfs_cppflags)
set(_lfs_ldflags)
set(_lfs_libs)
+ cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET 1)
message(STATUS "Looking for native LFS support")
check_c_source_compiles("${_lfs_test_source}" lfs_native)
+ cmake_pop_check_state()
if (lfs_native)
message(STATUS "Looking for native LFS support - found")
set(LFS_FOUND TRUE)