diff options
author | Andreas Schneider <asn@cynapses.org> | 2010-09-03 15:38:12 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cynapses.org> | 2010-09-03 15:38:12 +0200 |
commit | 2f8f230f617c4de1a2bd75352f4777f3592a1916 (patch) | |
tree | 6b539a5264f05ed97a6ae7f678fed9800f0076a0 /cmake | |
parent | 285388409f1e1220514cb161a2c17018c3d3de51 (diff) | |
download | libssh-2f8f230f617c4de1a2bd75352f4777f3592a1916.tar.gz libssh-2f8f230f617c4de1a2bd75352f4777f3592a1916.tar.xz libssh-2f8f230f617c4de1a2bd75352f4777f3592a1916.zip |
build: Added support to find argp on BSD.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/FindArgp.cmake | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/cmake/Modules/FindArgp.cmake b/cmake/Modules/FindArgp.cmake new file mode 100644 index 00000000..aa228557 --- /dev/null +++ b/cmake/Modules/FindArgp.cmake @@ -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) + |