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/python/CMakeLists.txt b/python/CMakeLists.txt
index d60eb64..16d6156 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -1,12 +1,12 @@
 find_program(PYTHON "python3")
 
-if (PYTHON)
+if(PYTHON)
     set(SETUP_PY_IN      "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in")
     set(SETUP_PY         "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
     set(PYAPI_BUILD_DIR  "${CMAKE_CURRENT_BINARY_DIR}/build")
     set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${PYAPI_BUILD_DIR})
-    
-    if(CMAKE_BUILD_TYPE STREQUAL debug)
+
+    if(CMAKE_BUILD_TYPE STREQUAL Debug)
         set(DEBUG "--debug")
     endif()
 
@@ -20,8 +20,8 @@
 
     configure_file(${SETUP_PY_IN} ${SETUP_PY})
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/Makefile.in ${CMAKE_CURRENT_BINARY_DIR}/docs/Makefile)
-	add_custom_target(pyapi ALL COMMAND ${PYTHON} ${SETUP_PY} build -b ${PYAPI_BUILD_DIR} ${DEBUG})
-	add_custom_target(pyapidoc COMMAND make -f ${CMAKE_CURRENT_BINARY_DIR}/docs/Makefile html)
+    add_custom_target(pyapi ALL COMMAND ${PYTHON} ${SETUP_PY} build -b ${PYAPI_BUILD_DIR} ${DEBUG})
+    add_custom_target(pyapidoc COMMAND make -f ${CMAKE_CURRENT_BINARY_DIR}/docs/Makefile html)
     execute_process(COMMAND ${PYTHON} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True))"
         OUTPUT_VARIABLE PYTHON_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
     install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} build -b ${PYAPI_BUILD_DIR} install --install-lib=\$ENV{DESTDIR}/${PYTHON_MODULE_PATH})")
diff --git a/python/setup.py.in b/python/setup.py.in
index c6cc1d4..6f912d9 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -2,7 +2,7 @@
 
 netconf2Module = Extension("netconf2",
                            sources=["${CMAKE_CURRENT_SOURCE_DIR}/netconf.c",
-                                    "${CMAKE_CURRENT_SOURCE_DIR}/session.c", 
+                                    "${CMAKE_CURRENT_SOURCE_DIR}/session.c",
                                     "${CMAKE_CURRENT_SOURCE_DIR}/ssh.c",
                                     "${CMAKE_CURRENT_SOURCE_DIR}/tls.c",
                                     "${CMAKE_CURRENT_SOURCE_DIR}/rpc.c",
@@ -13,7 +13,7 @@
                                     "${CMAKE_CURRENT_COURCE_DIR}/rpc.h"
                                    ],
                            libraries=["netconf2"],
-                           extra_compile_args=["-Wall", "-I${CMAKE_CURRENT_BINARY_DIR}", "-I${LIBYANG_INCLUDE_DIR}" @SSH_DEFINE@ @TLS_DEFINE@],
+                           extra_compile_args=["-Wall", "-I${CMAKE_CURRENT_BINARY_DIR}", "-I${LIBYANG_INCLUDE_DIR}", "-I${LIBSSH_INCLUDE_DIR}" @SSH_DEFINE@ @TLS_DEFINE@],
                            extra_link_args=["-L${CMAKE_CURRENT_BINARY_DIR}/.."],
                         )