summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-08-23 17:43:27 -0700
committerirungentoo <irungentoo@gmail.com>2013-08-23 17:43:27 -0700
commitc2c4ad8e5bfc25a50437b2486a46d07e10d497c9 (patch)
tree0d2d86c9d092610fc6495b5d7c6c4ec940b75a8a /cmake
parente2aa8161adc85795fe4d63d4642f47e90937ddc2 (diff)
parent1ec70337cfbf42f5f10d20c6152cdc5cf635df1b (diff)
Merge pull request #484 from jin-eld/shared-lib-pr
autotools build scripts - improved PR version 2
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindCheck.cmake46
-rw-r--r--cmake/FindCursesw.cmake47
-rw-r--r--cmake/FindLIBCONFIG.cmake20
-rw-r--r--cmake/FindNaCl.cmake17
-rw-r--r--cmake/FindSODIUM.cmake75
-rw-r--r--cmake/FindSphinx.cmake16
-rw-r--r--cmake/InstallPkgConfigFile.cmake78
7 files changed, 0 insertions, 299 deletions
diff --git a/cmake/FindCheck.cmake b/cmake/FindCheck.cmake
deleted file mode 100644
index e9e7f4d1..00000000
--- a/cmake/FindCheck.cmake
+++ /dev/null
@@ -1,46 +0,0 @@
1# - Try to find the CHECK libraries
2# Once done this will define
3#
4# CHECK_FOUND - system has check
5# CHECK_INCLUDE_DIR - the check include directory
6# CHECK_LIBRARIES - check library
7#
8# Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
9# Copyright (c) 2007 Bjoern Ricks <b.ricks@fh-osnabrueck.de>
10#
11# Redistribution and use is allowed according to the terms of the New
12# BSD license.
13# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
14
15
16INCLUDE( FindPkgConfig )
17
18# Take care about check.pc settings
19PKG_SEARCH_MODULE( CHECK check )
20
21# Look for CHECK include dir and libraries
22IF( NOT CHECK_FOUND )
23
24 FIND_PATH( CHECK_INCLUDE_DIR check.h )
25
26 FIND_LIBRARY( CHECK_LIBRARIES NAMES check )
27
28 IF ( CHECK_INCLUDE_DIR AND CHECK_LIBRARIES )
29 SET( CHECK_FOUND 1 )
30 IF ( NOT Check_FIND_QUIETLY )
31 MESSAGE ( STATUS "Found CHECK: ${CHECK_LIBRARIES}" )
32 ENDIF ( NOT Check_FIND_QUIETLY )
33 ELSE ( CHECK_INCLUDE_DIR AND CHECK_LIBRARIES )
34 IF ( Check_FIND_REQUIRED )
35 MESSAGE( FATAL_ERROR "Could NOT find CHECK" )
36 ELSE ( Check_FIND_REQUIRED )
37 IF ( NOT Check_FIND_QUIETLY )
38 MESSAGE( STATUS "Could NOT find CHECK" )
39 ENDIF ( NOT Check_FIND_QUIETLY )
40 ENDIF ( Check_FIND_REQUIRED )
41 ENDIF ( CHECK_INCLUDE_DIR AND CHECK_LIBRARIES )
42ENDIF( NOT CHECK_FOUND )
43
44# Hide advanced variables from CMake GUIs
45MARK_AS_ADVANCED( CHECK_INCLUDE_DIR CHECK_LIBRARIES )
46
diff --git a/cmake/FindCursesw.cmake b/cmake/FindCursesw.cmake
deleted file mode 100644
index bff02cec..00000000
--- a/cmake/FindCursesw.cmake
+++ /dev/null
@@ -1,47 +0,0 @@
1# - Find the curses include file and library
2#
3# CURSES_INCLUDE_DIR - the Curses include directory
4# CURSES_LIBRARIES - The libraries needed to use Curses
5# CURSES_HAVE_WIDE_CHAR - true if wide char is available
6# NO_WIDECHAR - Input variable, if set, disable wide char
7# ------------------------------------------------------------------------
8
9
10find_library(CURSES_LIBRARY "curses")
11find_library(CURSESW_LIBRARY "cursesw")
12
13find_library(NCURSES_LIBRARY "ncurses")
14find_library(NCURSESW_LIBRARY "ncursesw")
15
16if(NOT NO_WIDECHAR AND (CURSESW_LIBRARY OR NCURSESW_LIBRARY))
17 message(STATUS "Found wide character support")
18 set(CURSES_HAVE_WIDE_CHAR TRUE)
19 if(NCURSESW_LIBRARY)
20 set(CURSES_LIBRARIES ${NCURSESW_LIBRARY})
21 else()
22 set(CURSES_LIBRARIES ${CURSESW_LIBRARY})
23 endif()
24else()
25 message(STATUS "Could not found wide character support")
26 if(NCURSES_LIBRARY)
27 set(CURSES_LIBRARIES ${NCURSES_LIBRARY})
28 else()
29 set(CURSES_LIBRARIES ${CURSES_LIBRARY})
30 endif()
31endif()
32
33
34# We use curses.h not ncurses.h so let's not care about that for now
35
36if(CURSES_HAVE_WIDE_CHAR)
37 find_path(CURSES_INCLUDE_PATH curses.h PATH_SUFFIXES ncursesw)
38else()
39 find_path(CURSES_INCLUDE_PATH curses.h PATH_SUFFIXES ncurses)
40endif()
41
42set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH})
43
44include(FindPackageHandleStandardArgs)
45find_package_handle_standard_args(Cursesw DEFAULT_MSG CURSES_INCLUDE_DIR CURSES_LIBRARIES)
46
47
diff --git a/cmake/FindLIBCONFIG.cmake b/cmake/FindLIBCONFIG.cmake
deleted file mode 100644
index b3ae4d11..00000000
--- a/cmake/FindLIBCONFIG.cmake
+++ /dev/null
@@ -1,20 +0,0 @@
1# Find LIBCONFIG
2#
3# LIBCONFIG_INCLUDE_DIR
4# LIBCONFIG_LIBRARY
5# LIBCONFIG_FOUND
6#
7
8if (UNIX)
9 find_package(PkgConfig QUIET)
10 pkg_check_modules(_LIBCONFIG QUIET libconfig)
11endif ()
12
13FIND_PATH(LIBCONFIG_INCLUDE_DIR NAMES libconfig.h HINTS ${_LIBCONFIG_INCLUDEDIR})
14
15FIND_LIBRARY(LIBCONFIG_LIBRARY NAMES config)
16
17INCLUDE(FindPackageHandleStandardArgs)
18FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBCONFIG DEFAULT_MSG LIBCONFIG_LIBRARY LIBCONFIG_INCLUDE_DIR)
19
20MARK_AS_ADVANCED(LIBCONFIG_INCLUDE_DIR LIBCONFIG_LIBRARY)
diff --git a/cmake/FindNaCl.cmake b/cmake/FindNaCl.cmake
deleted file mode 100644
index cdd6248a..00000000
--- a/cmake/FindNaCl.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
1find_path(NACL_INCLUDE_DIR crypto_box.h
2 $ENV{NACL_INCLUDE_DIR} /usr/include/nacl/
3 DOC "Directory which contain NaCl headers")
4
5find_path(NACL_LIBRARY_DIR libnacl.a
6 $ENV{NACL_LIBRARY_DIR} /usr/lib/nacl
7 DOC "Directory which contain libnacl.a, cpucycles.o, and randombytes.o")
8
9if(NACL_LIBRARY_DIR)
10 set(NACL_LIBRARIES
11 "${NACL_LIBRARY_DIR}/cpucycles.o"
12 "${NACL_LIBRARY_DIR}/libnacl.a"
13 "${NACL_LIBRARY_DIR}/randombytes.o")
14endif()
15
16include(FindPackageHandleStandardArgs)
17find_package_handle_standard_args(NaCl DEFAULT_MSG NACL_INCLUDE_DIR NACL_LIBRARY_DIR NACL_LIBRARIES)
diff --git a/cmake/FindSODIUM.cmake b/cmake/FindSODIUM.cmake
deleted file mode 100644
index 6b0c2f23..00000000
--- a/cmake/FindSODIUM.cmake
+++ /dev/null
@@ -1,75 +0,0 @@
1# - Try to find SODIUM
2# Once done this will define
3#
4# SODIUM_ROOT_DIR - Set this variable to the root installation of CMocka
5#
6# Read-Only variables:
7# SODIUM_FOUND - system has SODIUM
8# SODIUM_INCLUDE_DIR - the SODIUM include directory
9# SODIUM_LIBRARIES - Link these to use SODIUM
10# SODIUM_DEFINITIONS - Compiler switches required for using SODIUM
11#
12#=============================================================================
13# Copyright (c) 2013 Andreas Schneider <asn@cryptomilk.org>
14#
15# Distributed under the OSI-approved BSD License (the "License");
16# see accompanying file Copyright.txt for details.
17#
18# This software is distributed WITHOUT ANY WARRANTY; without even the
19# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20# See the License for more information.
21#=============================================================================
22#
23
24set(_SODIUM_ROOT_HINTS
25)
26
27set(_SODIUM_ROOT_PATHS
28 "$ENV{PROGRAMFILES}/sodium"
29 "${CMAKE_SOURCE_DIR}/sodium"
30)
31
32find_path(SODIUM_ROOT_DIR
33 NAMES
34 include/sodium.h
35 HINTS
36 ${_SODIUM_ROOT_HINTS}
37 PATHS
38 ${_SODIUM_ROOT_PATHS}
39)
40mark_as_advanced(SODIUM_ROOT_DIR)
41
42find_path(SODIUM_INCLUDE_DIR
43 NAMES
44 sodium.h
45 PATHS
46 ${SODIUM_ROOT_DIR}/include
47)
48
49if(SHARED_LIBSODIUM)
50 set(WIN32_LIBSODIUM_FILENAME libsodium.dll.a)
51else()
52 set(WIN32_LIBSODIUM_FILENAME libsodium.a)
53endif()
54
55find_library(SODIUM_LIBRARY
56 NAMES
57 sodium
58 ${WIN32_LIBSODIUM_FILENAME}
59 PATHS
60 ${SODIUM_ROOT_DIR}/lib
61)
62
63if (SODIUM_LIBRARY)
64 set(SODIUM_LIBRARIES
65 ${SODIUM_LIBRARIES}
66 ${SODIUM_LIBRARY}
67 )
68endif (SODIUM_LIBRARY)
69
70include(FindPackageHandleStandardArgs)
71find_package_handle_standard_args(SODIUM DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIR)
72
73# show the SODIUM_INCLUDE_DIR and SODIUM_LIBRARIES variables only in the advanced view
74mark_as_advanced(SODIUM_INCLUDE_DIR SODIUM_LIBRARIES)
75
diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake
deleted file mode 100644
index 833bfd4d..00000000
--- a/cmake/FindSphinx.cmake
+++ /dev/null
@@ -1,16 +0,0 @@
1find_program(SPHINX_EXECUTABLE NAMES sphinx-build
2 HINTS
3 $ENV{SPHINX_DIR}
4 PATH_SUFFIXES bin
5 DOC "Sphinx documentation generator"
6)
7
8include(FindPackageHandleStandardArgs)
9
10find_package_handle_standard_args(Sphinx DEFAULT_MSG
11 SPHINX_EXECUTABLE
12)
13
14mark_as_advanced(
15 SPHINX_EXECUTABLE
16)
diff --git a/cmake/InstallPkgConfigFile.cmake b/cmake/InstallPkgConfigFile.cmake
deleted file mode 100644
index 7c4e5859..00000000
--- a/cmake/InstallPkgConfigFile.cmake
+++ /dev/null
@@ -1,78 +0,0 @@
1# A Macro to simplify creating a pkg-config file
2
3# install_pkg_config_file(<package-name>
4# [VERSION <version>]
5# [DESCRIPTION <description>]
6# [CFLAGS <cflag> ...]
7# [LIBS <lflag> ...]
8# [REQUIRES <required-package-name> ...])
9#
10# Create and install a pkg-config .pc file to CMAKE_INSTALL_PREFIX/lib/pkgconfig
11# assuming the following install layout:
12# libraries: CMAKE_INSTALL_PREFIX/lib
13# headers : CMAKE_INSTALL_PREFIX/include
14#
15# example:
16# add_library(mylib mylib.c)
17# install_pkg_config_file(mylib
18# DESCRIPTION My Library
19# CFLAGS
20# LIBS -lmylib
21# REQUIRES glib-2.0 lcm
22# VERSION 0.0.1)
23#
24#
25function(install_pkg_config_file)
26 list(GET ARGV 0 pc_name)
27 # TODO error check
28
29 set(pc_version 0.0.1)
30 set(pc_description ${pc_name})
31 set(pc_requires "")
32 set(pc_libs "")
33 set(pc_cflags "")
34 set(pc_fname "${CMAKE_BINARY_DIR}/lib/pkgconfig/${pc_name}.pc")
35
36 set(modewords LIBS CFLAGS REQUIRES VERSION DESCRIPTION)
37 set(curmode "")
38
39 # parse function arguments and populate pkg-config parameters
40 list(REMOVE_AT ARGV 0)
41 foreach(word ${ARGV})
42 list(FIND modewords ${word} mode_index)
43 if(${mode_index} GREATER -1)
44 set(curmode ${word})
45 elseif(curmode STREQUAL LIBS)
46 set(pc_libs "${pc_libs} ${word}")
47 elseif(curmode STREQUAL CFLAGS)
48 set(pc_cflags "${pc_cflags} ${word}")
49 elseif(curmode STREQUAL REQUIRES)
50 set(pc_requires "${pc_requires} ${word}")
51 elseif(curmode STREQUAL VERSION)
52 set(pc_version ${word})
53 set(curmode "")
54 elseif(curmode STREQUAL DESCRIPTION)
55 set(pc_description "${word}")
56 set(curmode "")
57 else(${mode_index} GREATER -1)
58 message("WARNING incorrect use of install_pkg_config_file (${word})")
59 break()
60 endif(${mode_index} GREATER -1)
61 endforeach(word)
62
63 # write the .pc file out
64 file(WRITE ${pc_fname}
65 "prefix=${CMAKE_INSTALL_PREFIX}\n"
66 "libdir=\${prefix}/lib\n"
67 "includedir=\${prefix}/include\n"
68 "\n"
69 "Name: ${pc_name}\n"
70 "Description: ${pc_description}\n"
71 "Requires: ${pc_requires}\n"
72 "Version: ${pc_version}\n"
73 "Libs: -L\${libdir} ${pc_libs}\n"
74 "Cflags: -I\${includedir} ${pc_cflags}\n")
75
76 # mark the .pc file for installation to the lib/pkgconfig directory
77 install(FILES ${pc_fname} DESTINATION lib/pkgconfig)
78endfunction(install_pkg_config_file)