1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-05 20:55:46 +03:00

cmake: Try to fix FindArgp module

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2016-03-17 10:42:52 +01:00
parent 252cd6eae9
commit 2384236849
4 changed files with 62 additions and 54 deletions

View File

@@ -48,7 +48,7 @@ endif(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW AND NOT OS2)
# HEADER FILES # HEADER FILES
set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ARGP_INCLUDE_DIRS}) set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ARGP_INCLUDE_DIR})
check_include_file(argp.h HAVE_ARGP_H) check_include_file(argp.h HAVE_ARGP_H)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})

View File

@@ -1,60 +1,66 @@
# - Try to find Argp # - Try to find ARGP
# Once done this will define # Once done this will define
# #
# ARGP_FOUND - system has Argp # ARGP_ROOT_DIR - Set this variable to the root installation of ARGP
# ARGP_INCLUDE_DIRS - the Argp include directory
# ARGP_LIBRARIES - Link these to use Argp
# ARGP_DEFINITIONS - Compiler switches required for using Argp
# #
# Copyright (c) 2010 Andreas Schneider <asn@cryptomilk.org> # Read-Only variables:
# ARGP_FOUND - system has ARGP
# ARGP_INCLUDE_DIR - the ARGP include directory
# ARGP_LIBRARIES - Link these to use ARGP
# ARGP_DEFINITIONS - Compiler switches required for using ARGP
# #
# Redistribution and use is allowed according to the terms of the New #=============================================================================
# BSD license. # Copyright (c) 2011-2016 Andreas Schneider <asn@cryptomilk.org>
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. #
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# #
set(_ARGP_ROOT_HINTS
)
if (ARGP_LIBRARIES AND ARGP_INCLUDE_DIRS) set(_ARGP_ROOT_PATHS
# in cache already "$ENV{PROGRAMFILES}/argp"
set(ARGP_FOUND TRUE) )
else (ARGP_LIBRARIES AND ARGP_INCLUDE_DIRS)
find_path(ARGP_INCLUDE_DIR find_path(ARGP_ROOT_DIR
NAMES NAMES
argp.h include/argp.h
HINTS
${_ARGP_ROOT_HINTS}
PATHS PATHS
/usr/include ${_ARGP_ROOT_PATHS}
/usr/local/include )
/opt/local/include mark_as_advanced(ARGP_ROOT_DIR)
/sw/include
)
find_library(ARGP_LIBRARY find_path(ARGP_INCLUDE_DIR
NAMES NAMES
argp argp.h
PATHS PATHS
/usr/lib ${ARGP_ROOT_DIR}/include
/usr/local/lib )
/opt/local/lib
/sw/lib find_library(ARGP_LIBRARY
NAMES
argp
PATHS
${ARGP_ROOT_DIR}/lib
)
if (ARGP_LIBRARY)
set(ARGP_LIBRARIES
${ARGP_LIBRARIES}
${ARGP_LIBRARY}
) )
endif (ARGP_LIBRARY)
set(ARGP_INCLUDE_DIRS include(FindPackageHandleStandardArgs)
${ARGP_INCLUDE_DIR} find_package_handle_standard_args(ARGP DEFAULT_MSG ARGP_LIBRARIES ARGP_INCLUDE_DIR)
)
if (ARGP_LIBRARY)
set(ARGP_LIBRARIES
${ARGP_LIBRARIES}
${ARGP_LIBRARY}
)
endif (ARGP_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Argp DEFAULT_MSG ARGP_LIBRARIES ARGP_INCLUDE_DIRS)
# show the ARGP_INCLUDE_DIRS and ARGP_LIBRARIES variables only in the advanced view
mark_as_advanced(ARGP_INCLUDE_DIRS ARGP_LIBRARIES)
endif (ARGP_LIBRARIES AND ARGP_INCLUDE_DIRS)
# show the ARGP_INCLUDE_DIR and ARGP_LIBRARIES variables only in the advanced view
mark_as_advanced(ARGP_INCLUDE_DIR ARGP_LIBRARIES)

View File

@@ -8,7 +8,7 @@ set(examples_SRCS
include_directories( include_directories(
${LIBSSH_PUBLIC_INCLUDE_DIRS} ${LIBSSH_PUBLIC_INCLUDE_DIRS}
${ARGP_INCLUDE_DIRS} ${ARGP_INCLUDE_DIR}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
) )
@@ -33,19 +33,19 @@ if (UNIX AND NOT WIN32)
if (WITH_SERVER) if (WITH_SERVER)
if (HAVE_LIBUTIL) if (HAVE_LIBUTIL)
add_executable(ssh_server_fork ssh_server_fork.c) add_executable(ssh_server_fork ssh_server_fork.c)
target_link_libraries(ssh_server_fork ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARIES} util) target_link_libraries(ssh_server_fork ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY} util)
endif (HAVE_LIBUTIL) endif (HAVE_LIBUTIL)
if (WITH_GSSAPI AND GSSAPI_FOUND) if (WITH_GSSAPI AND GSSAPI_FOUND)
add_executable(samplesshd-cb samplesshd-cb.c) add_executable(samplesshd-cb samplesshd-cb.c)
target_link_libraries(samplesshd-cb ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARIES}) target_link_libraries(samplesshd-cb ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY})
add_executable(proxy proxy.c) add_executable(proxy proxy.c)
target_link_libraries(proxy ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARIES}) target_link_libraries(proxy ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY})
endif (WITH_GSSAPI AND GSSAPI_FOUND) endif (WITH_GSSAPI AND GSSAPI_FOUND)
add_executable(samplesshd-kbdint samplesshd-kbdint.c) add_executable(samplesshd-kbdint samplesshd-kbdint.c)
target_link_libraries(samplesshd-kbdint ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARIES}) target_link_libraries(samplesshd-kbdint ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY})
endif (WITH_SERVER) endif (WITH_SERVER)
endif (UNIX AND NOT WIN32) endif (UNIX AND NOT WIN32)

View File

@@ -31,10 +31,12 @@ endif (LIBSSH_THREADS)
# create test library # create test library
add_library(${TORTURE_LIBRARY} STATIC cmdline.c torture.c) add_library(${TORTURE_LIBRARY} STATIC cmdline.c torture.c)
target_link_libraries(${TORTURE_LIBRARY} if (ARGP_LIBRARY)
${TORTURE_LINK_LIBRARIES} target_link_libraries(${TORTURE_LIBRARY}
${ARGP_LIBRARIES} ${TORTURE_LINK_LIBRARIES}
) ${ARGP_LIBRARY}
)
endif()
set(TEST_TARGET_LIBRARIES set(TEST_TARGET_LIBRARIES
${TORTURE_LIBRARY} ${TORTURE_LIBRARY}