# - Try to find voro++
# Once done this will define
# VORO++_FOUND - System has voro++
# VORO++_INCLUDE_DIRS - The voro++ include directories
# VORO++_LIBRARIES - The libraries needed to use voro++
# VORO++_DEFINITIONS - Compiler switches required for using voro++
find_package(PkgConfig)
pkg_check_modules(PC_VORO++ QUIET voro++)
set(VORO++_DEFINITIONS ${PC_VORO++_CFLAGS_OTHER})
find_path(VORO++_INCLUDE_DIR voro++.hh
HINTS ${PC_VORO++_INCLUDEDIR} ${PC_VORO++_INCLUDE_DIRS}
PATH_SUFFIXES voro++ )
find_library(VORO++_LIBRARY NAMES voro++
HINTS ${PC_VORO++_LIBDIR} ${PC_VORO++_LIBRARY_DIRS} )
set(VORO++_LIBRARIES ${VORO++_LIBRARY} )
set(VORO++_INCLUDE_DIRS ${VORO++_INCLUDE_DIR} )
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set VORO++_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(voro++ DEFAULT_MSG
VORO++_LIBRARY VORO++_INCLUDE_DIR)
mark_as_advanced(VORO++_INCLUDE_DIR VORO++_LIBRARY )
2. Then you are going to add the modules above in your CMakeLists.txt.
cmake_minimum_required(VERSION 2.6.2)
PROJECT(vtk_tetrahedron)
if(NOT CMAKE_MODULE_PATH)
set(CMAKE_MODULE_PATH)
endif()
list(APPEND CMAKE_MODULE_PATH /home/jesse/Jesse_Studio/cmake_find)
# set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})
find_package(Voro++ REQUIRED)
include_directories(${VORO++_INCLUDE_DIR})
add_executable(Tetrahedron Tetrahedron.cxx)
if(VTK_LIBRARIES)
target_link_libraries(Tetrahedron ${VTK_LIBRARIES})
else()
target_link_libraries(Tetrahedron vtkHybrid )
endif()
if(VORO++_LIBRARIES)
target_link_libraries(Tetrahedron ${VORO++_LIBRARIES})
endif()
3. That's it. Use you cmake normally.
No comments:
Post a Comment