build CHANGE simplify libnetconf2 cmake search module
Use standard cmake modules for getting information about functionality
provided by the compiled library.
diff --git a/FindLibNETCONF2.cmake b/FindLibNETCONF2.cmake
index 824c0b6..d0e9580 100644
--- a/FindLibNETCONF2.cmake
+++ b/FindLibNETCONF2.cmake
@@ -4,8 +4,8 @@
# LIBNETCONF2_FOUND - system has LibNETCONF2
# LIBNETCONF2_INCLUDE_DIRS - the LibNETCONF2 include directory
# LIBNETCONF2_LIBRARIES - Link these to use LibNETCONF2
-# LIBNETCONF2_ENABLE_SSH - LibNETCONF2 was compiled with SSH support
-# LIBNETCONF2_ENABLE_TLS - LibNETCONF2 was compiled with TLS support
+# LIBNETCONF2_ENABLED_SSH - LibNETCONF2 was compiled with SSH support
+# LIBNETCONF2_ENABLED_TLS - LibNETCONF2 was compiled with TLS support
#
# Author Michal Vasko <mvasko@cesnet.cz>
# Copyright (c) 2015 CESNET, z.s.p.o.
@@ -34,6 +34,8 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+INCLUDE(CheckSymbolExists)
+
if (LIBNETCONF2_LIBRARIES AND LIBNETCONF2_INCLUDE_DIRS)
# in cache already
set(LIBNETCONF2_FOUND TRUE)
@@ -71,19 +73,8 @@
if (LIBNETCONF2_INCLUDE_DIR AND LIBNETCONF2_LIBRARY)
set(LIBNETCONF2_FOUND TRUE)
# check compile flags
- execute_process(COMMAND grep ENABLE_SSH ${LIBNETCONF2_INCLUDE_DIR}/nc_client.h RESULT_VARIABLE RETURN OUTPUT_QUIET ERROR_QUIET)
- if (RETURN EQUAL 0)
- set(LIBNETCONF2_ENABLE_SSH TRUE)
- else (RETURN EQUAL 0)
- set(LIBNETCONF2_ENABLE_SSH FALSE)
- endif (RETURN EQUAL 0)
-
- execute_process(COMMAND grep ENABLE_TLS ${LIBNETCONF2_INCLUDE_DIR}/nc_client.h RESULT_VARIABLE RETURN OUTPUT_QUIET ERROR_QUIET)
- if (RETURN EQUAL 0)
- set(LIBNETCONF2_ENABLE_TLS TRUE)
- else (RETURN EQUAL 0)
- set(LIBNETCONF2_ENABLE_TLS FALSE)
- endif (RETURN EQUAL 0)
+ check_symbol_exists("NC_ENABLED_SSH" "nc_client.h" LIBNETCONF2_ENABLED_SSH)
+ check_symbol_exists("NC_ENABLED_TLS" "nc_client.h" LIBNETCONF2_ENABLED_TLS)
else (LIBNETCONF2_INCLUDE_DIR AND LIBNETCONF2_LIBRARY)
set(LIBNETCONF2_FOUND FALSE)
endif (LIBNETCONF2_INCLUDE_DIR AND LIBNETCONF2_LIBRARY)