Prevent compile errors on OSX (#198)
build CHANGE prevent compile errors on OSX
* Prevent compile errors on OSX
clangtidy cmake files too
fix possible buffer overflow too
* Fix travis build error
The imported include path setting is only later needed!
* Fix libssh version detection
Cmake variable is now LIBSSH_VERSION!
* python: do not put generated files into the source tree
Untracked content shows up in git submodules, causing stuff to be marked
"dirty" by various git-level tools.
Tested by temporarily putting the resulting target within `ALL`. The
result is the same as without this change (and it remains unusable with
no generated index, at least when building out-of-tree, BTW).
* apply review notes
* Prevent compile errors on OSX
clangtidy cmake files too
fix possible buffer overflow too
* Fix travis build error
The imported include path setting is only later needed!
* Fix libssh version detection
Cmake variable is now LIBSSH_VERSION!
* apply review notes
Co-authored-by: Jan Kundrát <jkt@flaska.net>
diff --git a/CMakeModules/FindLibYANG.cmake b/CMakeModules/FindLibYANG.cmake
index b3478b1..51fdc88 100644
--- a/CMakeModules/FindLibYANG.cmake
+++ b/CMakeModules/FindLibYANG.cmake
@@ -3,7 +3,7 @@
#
# LIBYANG_FOUND - system has LibYANG
# LIBYANG_INCLUDE_DIRS - the LibYANG include directory
-# LIBYANG_LIBRARIES - Link these to use LibSSH
+# LIBYANG_LIBRARIES - Link these to use LibYANG
#
# Author Radek Krejci <rkrejci@cesnet.cz>
# Copyright (c) 2015 CESNET, z.s.p.o.
@@ -17,7 +17,7 @@
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
-# 3. The name of the author may not be used to endorse or promote products
+# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
@@ -32,10 +32,10 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-if (LIBYANG_LIBRARIES AND LIBYANG_INCLUDE_DIRS)
+if(LIBYANG_LIBRARIES AND LIBYANG_INCLUDE_DIRS)
# in cache already
set(LIBYANG_FOUND TRUE)
-else (LIBYANG_LIBRARIES AND LIBYANG_INCLUDE_DIRS)
+else()
find_path(LIBYANG_INCLUDE_DIR
NAMES
@@ -48,7 +48,7 @@
${CMAKE_INCLUDE_PATH}
${CMAKE_INSTALL_PREFIX}/include
)
-
+
find_library(LIBYANG_LIBRARY
NAMES
yang
@@ -64,17 +64,20 @@
${CMAKE_INSTALL_PREFIX}/lib
)
- if (LIBYANG_INCLUDE_DIR AND LIBYANG_LIBRARY)
+ if(LIBYANG_INCLUDE_DIR AND LIBYANG_LIBRARY)
set(LIBYANG_FOUND TRUE)
- else (LIBYANG_INCLUDE_DIR AND LIBYANG_LIBRARY)
+ else()
set(LIBYANG_FOUND FALSE)
- endif (LIBYANG_INCLUDE_DIR AND LIBYANG_LIBRARY)
+ endif()
set(LIBYANG_INCLUDE_DIRS ${LIBYANG_INCLUDE_DIR})
set(LIBYANG_LIBRARIES ${LIBYANG_LIBRARY})
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(LIBYANG DEFAULT_MSG LIBYANG_LIBRARIES LIBYANG_INCLUDE_DIRS)
+
# show the LIBYANG_INCLUDE_DIRS and LIBYANG_LIBRARIES variables only in the advanced view
mark_as_advanced(LIBYANG_INCLUDE_DIRS LIBYANG_LIBRARIES)
-endif (LIBYANG_LIBRARIES AND LIBYANG_INCLUDE_DIRS)
+endif()