From 3b43142f3336ebbe36c421c989fdbec5bc6a1912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= Date: Tue, 26 Jul 2016 15:11:12 +0200 Subject: [PATCH] cmake: Fix symbol detection on non-standard include paths We're still in the FindModule scope and the global include directories therefore very likely do not contain the required path. I used list(INSERT ... 0) and list(REMOVE_AT ... 0) instead of the more intuitive APPEND and REMOVE_ITEM because REMOVE_ITEM actually removes all occurrences. That might affect the global state which is exactly not what a find_package ought to do. If the minimal required CMake was 2.8.6+, one could have used CMakePushCheckState, but it isn't available in 2.6. --- CMakeModules/FindLibNETCONF2.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeModules/FindLibNETCONF2.cmake b/CMakeModules/FindLibNETCONF2.cmake index e809624c0..1b30206c3 100644 --- a/CMakeModules/FindLibNETCONF2.cmake +++ b/CMakeModules/FindLibNETCONF2.cmake @@ -71,9 +71,11 @@ else (LIBNETCONF2_LIBRARIES AND LIBNETCONF2_INCLUDE_DIRS) if (LIBNETCONF2_INCLUDE_DIR AND LIBNETCONF2_LIBRARY) set(LIBNETCONF2_FOUND TRUE) - # check compile flags + # check the configured options and make them available through cmake + list(INSERT CMAKE_REQUIRED_INCLUDES 0 "${LIBNETCONF2_INCLUDE_DIR}") check_symbol_exists("NC_ENABLED_SSH" "nc_client.h" LIBNETCONF2_ENABLED_SSH) check_symbol_exists("NC_ENABLED_TLS" "nc_client.h" LIBNETCONF2_ENABLED_TLS) + list(REMOVE_AT CMAKE_REQUIRED_INCLUDES 0) else (LIBNETCONF2_INCLUDE_DIR AND LIBNETCONF2_LIBRARY) set(LIBNETCONF2_FOUND FALSE) endif (LIBNETCONF2_INCLUDE_DIR AND LIBNETCONF2_LIBRARY)