CMakeLists.txt for FLANN example

cmake_minimum_required(VERSION 2.8)

set(PROJ_NAME testFlann)
PROJECT(${PROJ_NAME})

# Prevent compilation in-source
if( ${CMAKE_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR} )
Message( FATAL_ERROR "In-source build is not allowed. Create a build directory and run cmake in the directory.")
endif()

# enable C++11
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

set(EXT_DIR ${CMAKE_SOURCE_DIR}/extern CACHE STRING "directory storing all external libraries")
list( APPEND CMAKE_MODULE_PATH
${EXT_DIR}
)
find_package(Flann REQUIRED)
find_package(HDF5 REQUIRED)

include_directories(${FLANN_INCLUDE_DIRS})
include_directories(${HDF5_INCLUDE_DIRS})

link_directories(${HDF5_LIBRARY_DIRS})

add_executable(${PROJ_NAME}
main.cpp
)
target_link_libraries(${PROJ_NAME}
${FLANN_LIBRARIES}
${HDF5_LIBRARIES}
)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s