Skip to content

Commit

Permalink
First take at cmake cleanup and refactoring
Browse files Browse the repository at this point in the history
* Removed old/dead/suspicious cmake code
* Put all dependency checking in FindX.cmake macros

This breaks CORBA and .pc file generation
  • Loading branch information
Peter Soetens committed Jun 4, 2009
1 parent 62eee46 commit a10984e
Show file tree
Hide file tree
Showing 7 changed files with 244 additions and 210 deletions.
25 changes: 25 additions & 0 deletions config/FindEcos.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# This macro is a dirty hack, Orocos specific. Don't base your macros on it, look into the other
# Find*cmake files for better examples

# This script creates the following variables:
# Ecos_FOUND: Boolean that indicates if the package was found
# Ecos_INCLUDE_DIRS: Paths to the necessary header files
# Ecos_LIBRARIES: Package libraries

set(ECOS_INSTALL_DIR ${ECOS_INSTALL_DIR} CACHE PATH "path to ecos installation dir" FORCE)

if (ECOS_INSTALL_DIR STREQUAL "")
set(ECOS_INSTALL_DIR "/opt/ecos/install")
endif (ECOS_INSTALL_DIR STREQUAL "")

if(EXISTS ${ECOS_INSTALL_DIR}/include/pkgconf/system.h)
message("-- Looking for ECOS - found in ${ECOS_INSTALL_DIR}")
set(ECOS_FOUND TRUE)
set(ECOS_INCLUDE_DIRS ${ECOS_INSTALL_DIR}/include )
set(ECOS_LIBRARIES -L${ECOS_INSTALL_DIR}/lib -ltarget )
else()
message(FATAL_ERROR "-- Looking for ECOS - not found (tried: ${ECOS_INSTALL_DIR}/include/pkgconf/system.h)")
set(ECOS_FOUND FALSE)
ENDIF()

53 changes: 53 additions & 0 deletions config/FindRTAI.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
################################################################################
#
# CMake script for finding RTAI/LXRT.
# If the optional RTAI_ROOT_DIR environment variable exists, header files and
# libraries will be searched in the RTAI_ROOT_DIR/include and RTAI_ROOT_DIR/lib
# directories, respectively. Otherwise the default CMake search process will be
# used.
#
# This script creates the following variables:
# RTAI_FOUND: Boolean that indicates if the package was found
# RTAI_INCLUDE_DIRS: Paths to the necessary header files
# RTAI_LIBRARIES: Package libraries
#
################################################################################

include(LibFindMacros)

# Get hint from environment variable (if any)
if(NOT $ENV{RTAI_ROOT_DIR} STREQUAL "")
set(RTAI_ROOT_DIR $ENV{RTAI_ROOT_DIR} CACHE PATH "RTAI base directory location (optional, used for nonstandard installation paths)" FORCE)
mark_as_advanced(RTAI_ROOT_DIR)
endif()

# Header files to find
set(header_NAME rtai_lxrt.h)

# Libraries to find
set(rtai_NAME lxrt)

# Find headers and libraries
if(RTAI_ROOT_DIR)
# Use location specified by environment variable
find_path(RTAI_INCLUDE_DIR NAMES ${header_NAME} PATHS ${RTAI_ROOT_DIR}/include PATH_SUFFIXES rtai NO_DEFAULT_PATH)
find_library(RTAI_LIBRARY NAMES ${rtai_NAME} PATHS ${RTAI_ROOT_DIR}/lib NO_DEFAULT_PATH)
else()
# Use default CMake search process
find_path(RTAI_INCLUDE_DIR NAMES ${header_NAME} PATH_SUFFIXES rtai )
find_library(RTAI_LIBRARY NAMES ${rtai_NAME})
endif()

# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(RTAI_PROCESS_INCLUDES RTAI_INCLUDE_DIR)
set(RTAI_PROCESS_LIBS RTAI_LIBRARY)

# If user provides Linux source dir, check and append it as well
if( LINUX_SOURCE_DIR )
set(linux_header_NAME linux/kernel.h)
find_path(Linux_INCLUDE_DIR NAMES ${linux_header_NAME} PATHS ${LINUX_SOURCE_DIR} NO_DEFAULT_PATH)
list(APPEND RTAI_PROCESS_INCLUDES Linux_INCLUDE_DIR)
endif()

libfind_process(RTAI)
46 changes: 46 additions & 0 deletions config/FindXenomai.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
################################################################################
#
# CMake script for finding XENOMAI.
# If the optional XENOMAI_ROOT_DIR environment variable exists, header files and
# libraries will be searched in the XENOMAI_ROOT_DIR/include and XENOMAI_ROOT_DIR/lib
# directories, respectively. Otherwise the default CMake search process will be
# used.
#
# This script creates the following variables:
# XENOMAI_FOUND: Boolean that indicates if the package was found
# XENOMAI_INCLUDE_DIRS: Paths to the necessary header files
# XENOMAI_LIBRARIES: Package libraries
#
################################################################################

include(LibFindMacros)

# Get hint from environment variable (if any)
if(NOT $ENV{XENOMAI_ROOT_DIR} STREQUAL "")
set(XENOMAI_ROOT_DIR $ENV{XENOMAI_ROOT_DIR} CACHE PATH "Xenomai base directory location (optional, used for nonstandard installation paths)" FORCE)
mark_as_advanced(XENOMAI_ROOT_DIR)
endif()

# Header files to find
set(header_NAME native/task.h)

# Libraries to find
set(XENOMAI_NAME native)

# Find headers and libraries
if(XENOMAI_ROOT_DIR)
# Use location specified by environment variable
find_path(XENOMAI_INCLUDE_DIR NAMES ${header_NAME} PATHS ${XENOMAI_ROOT_DIR}/include PATH_SUFFIXES xenomai NO_DEFAULT_PATH)
find_library(XENOMAI_LIBRARY NAMES ${XENOMAI_NAME} PATHS ${XENOMAI_ROOT_DIR}/lib NO_DEFAULT_PATH)
else()
# Use default CMake search process
find_path(XENOMAI_INCLUDE_DIR NAMES ${header_NAME} PATH_SUFFIXES xenomai )
find_library(XENOMAI_LIBRARY NAMES ${XENOMAI_NAME})
endif()

# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(XENOMAI_PROCESS_INCLUDES XENOMAI_INCLUDE_DIR)
set(XENOMAI_PROCESS_LIBS XENOMAI_LIBRARY)

libfind_process(XENOMAI)
38 changes: 19 additions & 19 deletions config/FindXerces.cmake
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
################################################################################
#
# CMake script for finding Xerces.
# If the optional Xerces_ROOT_DIR environment variable exists, header files and
# libraries will be searched in the Xerces_ROOT_DIR/include and Xerces_ROOT_DIR/libs
# If the optional XERCES_ROOT_DIR environment variable exists, header files and
# libraries will be searched in the XERCES_ROOT_DIR/include and XERCES_ROOT_DIR/libs
# directories, respectively. Otherwise the default CMake search process will be
# used.
#
# This script creates the following variables:
# Xerces_FOUND: Boolean that indicates if the package was found
# Xerces_INCLUDE_DIRS: Paths to the necessary header files
# Xerces_LIBRARIES: Package libraries
# XERCES_FOUND: Boolean that indicates if the package was found
# XERCES_INCLUDE_DIRS: Paths to the necessary header files
# XERCES_LIBRARIES: Package libraries
#
################################################################################

include(LibFindMacros)

# Get hint from environment variable (if any)
if(NOT $ENV{Xerces_ROOT_DIR} STREQUAL "")
set(Xerces_ROOT_DIR $ENV{Xerces_ROOT_DIR} CACHE PATH "Xerces base directory location (optional, used for nonstandard installation paths)" FORCE)
mark_as_advanced(Xerces_ROOT_DIR)
if(NOT $ENV{XERCES_ROOT_DIR} STREQUAL "")
set(XERCES_ROOT_DIR $ENV{XERCES_ROOT_DIR} CACHE PATH "Xerces base directory location (optional, used for nonstandard installation paths)" FORCE)
mark_as_advanced(XERCES_ROOT_DIR)
endif()

# Header files to find
Expand All @@ -29,21 +29,21 @@ set(xerces_c_NAME xerces-c)
set(xerces_depdom_NAME xerces-depdom)

# Find headers and libraries
if(Xerces_ROOT_DIR)
if(XERCES_ROOT_DIR)
# Use location specified by environment variable
find_path(Xerces_INCLUDE_DIR NAMES ${header_NAME} PATHS ${Xerces_ROOT_DIR}/include NO_DEFAULT_PATH)
find_library(Xerces_c_LIBRARY NAMES ${xerces_c_NAME} PATHS ${Xerces_ROOT_DIR}/lib NO_DEFAULT_PATH)
find_library(Xerces_depdom_LIBRARY NAMES ${xerces_depdom_NAME} PATHS ${Xerces_ROOT_DIR}/lib NO_DEFAULT_PATH)
find_path(XERCES_INCLUDE_DIR NAMES ${header_NAME} PATHS ${XERCES_ROOT_DIR}/include NO_DEFAULT_PATH)
find_library(XERCES_C_LIBRARY NAMES ${xerces_c_NAME} PATHS ${XERCES_ROOT_DIR}/lib NO_DEFAULT_PATH)
find_library(XERCES_depdom_LIBRARY NAMES ${xerces_depdom_NAME} PATHS ${XERCES_ROOT_DIR}/lib NO_DEFAULT_PATH)
else()
# Use default CMake search process
find_path(Xerces_INCLUDE_DIR NAMES ${header_NAME})
find_library(Xerces_c_LIBRARY NAMES ${xerces_c_NAME})
find_library(Xerces_depdom_LIBRARY NAMES ${xerces_depdom_NAME})
find_path(XERCES_INCLUDE_DIR NAMES ${header_NAME})
find_library(XERCES_C_LIBRARY NAMES ${xerces_c_NAME})
find_library(XERCES_DEPDOM_LIBRARY NAMES ${xerces_depdom_NAME})
endif()

# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(Xerces_PROCESS_INCLUDES Xerces_INCLUDE_DIR)
set(Xerces_PROCESS_LIBS Xerces_c_LIBRARY
Xerces_depdom_LIBRARY)
libfind_process(Xerces)
set(XERCES_PROCESS_INCLUDES XERCES_INCLUDE_DIR)
set(XERCES_PROCESS_LIBS XERCES_C_LIBRARY
XERCES_DEPDOM_LIBRARY)
libfind_process(XERCES)
Loading

0 comments on commit a10984e

Please sign in to comment.