2011-03-13 16:38:23 -05:00
|
|
|
cmake_minimum_required(VERSION 2.4.6)
|
|
|
|
|
|
2011-03-19 14:50:34 -05:00
|
|
|
project(Serial)
|
2011-03-13 16:38:23 -05:00
|
|
|
|
2011-03-19 14:50:34 -05:00
|
|
|
# set the default path for built executables to the "bin" directory
|
|
|
|
|
IF(NOT DEFINED(EXECUTABLE_OUTPUT_PATH))
|
|
|
|
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
|
|
|
|
|
ENDIF(NOT DEFINED(EXECUTABLE_OUTPUT_PATH))
|
|
|
|
|
# set the default path for built libraries to the "lib" directory
|
|
|
|
|
IF(NOT DEFINED(LIBRARY_OUTPUT_PATH))
|
|
|
|
|
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
|
|
|
|
|
ENDIF(NOT DEFINED(LIBRARY_OUTPUT_PATH))
|
2011-03-19 14:16:41 -05:00
|
|
|
|
2011-03-19 14:50:34 -05:00
|
|
|
# add the include folder to the include path
|
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/include)
|
2011-03-19 14:16:41 -05:00
|
|
|
|
2011-03-19 14:50:34 -05:00
|
|
|
# Find Boost
|
|
|
|
|
find_package(Boost COMPONENTS system filesystem thread REQUIRED)
|
2011-03-19 14:16:41 -05:00
|
|
|
|
2011-03-19 14:50:34 -05:00
|
|
|
# Compile the Serial Library
|
|
|
|
|
add_library(serial src/serial.cpp include/serial.h)
|
|
|
|
|
target_link_libraries(serial ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY})
|
|
|
|
|
|
|
|
|
|
# Compile the Test program
|
|
|
|
|
add_executable(test_serial src/test_serial.cpp)
|
|
|
|
|
# Link the Test program to the Serial library
|
2011-03-19 14:16:41 -05:00
|
|
|
target_link_libraries(test_serial serial)
|
|
|
|
|
|
|
|
|
|
# Check for OS X and if so disable kqueue support in asio
|
|
|
|
|
IF(CMAKE_SYSTEM_NAME MATCHES Darwin)
|
|
|
|
|
add_definitions(-DBOOST_ASIO_DISABLE_KQUEUE)
|
|
|
|
|
ENDIF(CMAKE_SYSTEM_NAME MATCHES Darwin)
|
2011-03-19 15:15:29 -05:00
|
|
|
|
|
|
|
|
# Configure make install
|
2011-03-19 15:35:50 -05:00
|
|
|
IF(NOT CMAKE_INSTALL_PREFIX)
|
2011-03-19 15:15:29 -05:00
|
|
|
SET(CMAKE_INSTALL_PREFIX /usr/local)
|
2011-03-19 15:35:50 -05:00
|
|
|
ENDIF(NOT CMAKE_INSTALL_PREFIX)
|
2011-03-19 15:15:29 -05:00
|
|
|
|
|
|
|
|
INSTALL(TARGETS serial
|
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
INSTALL(FILES include/serial.h DESTINATION include)
|
|
|
|
|
|
|
|
|
|
# INSTALL(FILES ../Findserial.cmake DESTINATION ${CMAKE_ROOT}/Modules/)
|