mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-05 20:55:46 +03:00
build: Added support to find argp on BSD.
This commit is contained in:
60
cmake/Modules/FindArgp.cmake
Normal file
60
cmake/Modules/FindArgp.cmake
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
# - Try to find Argp
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# ARGP_FOUND - system has 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@cynapses.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
if (ARGP_LIBRARIES AND ARGP_INCLUDE_DIRS)
|
||||||
|
# in cache already
|
||||||
|
set(ARGP_FOUND TRUE)
|
||||||
|
else (ARGP_LIBRARIES AND ARGP_INCLUDE_DIRS)
|
||||||
|
|
||||||
|
find_path(ARGP_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
argp.h
|
||||||
|
PATHS
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
/opt/local/include
|
||||||
|
/sw/include
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(ARGP_LIBRARY
|
||||||
|
NAMES
|
||||||
|
argp
|
||||||
|
PATHS
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
set(ARGP_INCLUDE_DIRS
|
||||||
|
${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)
|
||||||
|
|
@@ -1,18 +1,22 @@
|
|||||||
project(tests C)
|
project(tests C)
|
||||||
|
|
||||||
|
if (${CMAKE_SYSTEM_NAME} MATCHES "(OpenBSD|FreeBSD)")
|
||||||
|
find_package(Argp)
|
||||||
|
endif (${CMAKE_SYSTEM_NAME} MATCHES "(OpenBSD|FreeBSD)")
|
||||||
|
|
||||||
set(TORTURE_LIBRARY torture)
|
set(TORTURE_LIBRARY torture)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${LIBSSH_PUBLIC_INCLUDE_DIRS}
|
${LIBSSH_PUBLIC_INCLUDE_DIRS}
|
||||||
${CHECK_INCLUDE_DIRS}
|
${CHECK_INCLUDE_DIRS}
|
||||||
|
${ARGP_INCLUDE_DIRS}
|
||||||
${CMAKE_BINARY_DIR}
|
${CMAKE_BINARY_DIR}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# create test library
|
# create test library
|
||||||
add_library(${TORTURE_LIBRARY} SHARED torture.c cmdline.c)
|
add_library(${TORTURE_LIBRARY} SHARED torture.c cmdline.c)
|
||||||
target_link_libraries(${TORTURE_LIBRARY} ${CHECK_LIBRARIES} ${LIBSSH_STATIC_LIBRARY} ${LIBSSH_LINK_LIBRARIES})
|
target_link_libraries(${TORTURE_LIBRARY} ${CHECK_LIBRARIES} ${LIBSSH_STATIC_LIBRARY} ${LIBSSH_LINK_LIBRARIES} ${ARGP_LIBRARIES})
|
||||||
|
|
||||||
set(TEST_TARGET_LIBRARIES ${SUPPORT_LIBRARY} ${LIBSSH_LINK_LIBRARIES})
|
set(TEST_TARGET_LIBRARIES ${SUPPORT_LIBRARY} ${LIBSSH_LINK_LIBRARIES})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user