Settings.cmake
Go to the documentation of this file.
1 # ============================================================================
2 # Copyright (c) 2015 <provider-name>
3 # All rights reserved.
4 #
5 # See COPYING file for license information.
6 # ============================================================================
7 
8 ##############################################################################
9 # @file Settings.cmake
10 # @brief Non-default project settings.
11 #
12 # This file is included by basis_project_impl(), after it looked for the
13 # required and optional dependencies and the CMake variables related to the
14 # project directory structure were defined (see Directories.cmake file in
15 # @c BINARY_CONFIG_DIR). It is also included before the BasisSettings.cmake
16 # file.
17 #
18 # In particular build options should be added in this file using CMake's
19 # <a href="http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:option">
20 # option()</a> command. Further, any common settings related to using a found
21 # dependency can be set here if the basis_use_package() command was enable
22 # to import the required configuration of a particular external package.
23 #
24 # @ingroup BasisSettings
25 ##############################################################################
26 
27 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_PROJECT_DIR}/config)
28 
29 # Enable C++11
30 include(CheckCXXCompilerFlag)
31 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
32 CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
33 if(COMPILER_SUPPORTS_CXX11)
34  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
35 elseif(COMPILER_SUPPORTS_CXX0X)
36  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
37 else()
38  message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support, or our tests failed to detect it correctly. Please use a different C++ compiler or report this problem to the developers.")
40 
41 if(UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
42  ADD_DEFINITIONS(-fPIC)
43 endif(UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
44 
45 
46 # Link the boost.log library
47 # @todo consider an alternative to always linking boost log
48 ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
49 
50 # OSX RPATH
51 if(APPLE)
52  set(CMAKE_MACOSX_RPATH ON)
53  #set(CMAKE_SKIP_BUILD_RPATH FALSE)
54  #set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
55  #set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
56  #set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
57  #list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
58  #if("${isSystemDir}" STREQUAL "-1")
59  # set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
60  #endif()
61 endif()
62 
63 if(OpenCV_FOUND)
64  if(NOT ${OpenCV_VERSION} VERSION_LESS 3.0.0)
65  add_definitions(-DHAVE_OPENCV3)
66  endif()
67 endif()
68 
69 # list flatbuffer headers
70 set(RFB ArmControlState.fbs Geometry.fbs JointState.fbs KUKAiiwa.fbs LinkObject.fbs Euler.fbs Time.fbs VrepControlPoint.fbs VrepPath.fbs)
71 # directory to include flatbuffers
72 set(GRL_FLATBUFFERS_INCLUDE_DIR ${CMAKE_BINARY_DIR}/include)
73 # Generate flatbuffer message C++ headers
74 flatbuffers_generate_c_headers(GRL_FLATBUFFERS include/grl/flatbuffer/ ${GRL_FLATBUFFERS_INCLUDE_DIR}/grl/flatbuffer ${RFB})
75 add_custom_target(grlflatbuffers DEPENDS ${GRL_FLATBUFFERS_OUTPUTS})
76 basis_include_directories(${GRL_FLATBUFFERS_INCLUDE_DIR} )
77 
78 # workaround so that compilation will work if FindFRI-Client-SDK_Cpp is a module
79 # it may also be an external, see config/FindFRI-Client-SDK_Cpp
80 # if(MODULE_FRI-Client-SDK_Cpp)
81 # set(FRI-Client-SDK_Cpp_LIBRARIES KukaFRIClient)
82 #
83 # if(NOT Nanopb_FOUND)
84 # set(Nanopb_LIBRARIES nanopb)
85 # endif()
86 # endif()
87 
88 
89 
90 if(CISSTNETLIB_FOUND)
91  set(CISSTNETLIB_INCLUDE_DIRS ${CISSTNETLIB_INCLUDE_DIR})
92 endif()
93 
include flatbuffers_generate_c_headers(GRL_FLATBUFFERS include/grl/flatbuffer/${GRL_FLATBUFFERS_INCLUDE_DIR}/grl/flatbuffer ${RFB}) add_custom_target(grlflatbuffers DEPENDS $
Definition: Settings.cmake:74
or our tests failed to detect it correctly Please use a different C compiler or report this problem to the developers endif() if(UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") endif(UNIX AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") if(APPLE) set(CMAKE_MACOSX_RPATH ON)() endif() if(OpenCV_FOUND) if(NOT $
Definition: Settings.cmake:39
VERSION_LESS add_definitions(-DHAVE_OPENCV3) endif() endif() set(RFB ArmControlState.fbs Geometry.fbs JointState.fbs KUKAiiwa.fbs LinkObject.fbs Euler.fbs Time.fbs VrepControlPoint.fbs VrepPath.fbs) set(GRL_FLATBUFFERS_INCLUDE_DIR $
Definition: Settings.cmake:65
basis_include_directories(${GRL_FLATBUFFERS_INCLUDE_DIR})() if(CISSTNETLIB_FOUND) set(CISSTNETLIB_INCLUDE_DIRS $
Definition: Settings.cmake:76
if(EXISTS "${PROJECT_DOC_DIR}/CMakeLists.txt") option(BUILD_DOCUMENTATION "Request build and/or installation of documentation." OFF) endif() if(EXISTS "$