Skip to content

Commit

Permalink
cmake: Fix symbol detection on non-standard include paths
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jktjkt committed Jul 26, 2016
1 parent 7835ede commit 3b43142
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CMakeModules/FindLibNETCONF2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3b43142

Please sign in to comment.