view extern/vera/src/CMakeLists.txt @ 683:d30793525261

CMake: global cleanup, remove useless definitions and libraries
author David Demelier <markand@malikania.fr>
date Thu, 12 Apr 2018 19:30:43 +0200
parents a7c0eb100760
children
line wrap: on
line source

find_package(TCL) # REQUIRED)
# don't use find_package's REQUIRED parameter to avoid requiring tk
if(NOT TCL_FOUND)
  message(FATAL_ERROR "TCL was not found.")
endif()
include_directories(SYSTEM ${TCL_INCLUDE_PATH})
link_directories(${TCL_LIBRARY_DIRS})

set(boostLibs filesystem system program_options regex wave)

if(WIN32)
  # use boost static libs to avoid LNK2019 errors
  # feel free to contribute a better fix!
  set(Boost_USE_STATIC_LIBS ON)
else()
  # expose the Boost_USE_STATIC_LIBS option to ease the manual creation of
  # packages with cpack
  option(Boost_USE_STATIC_LIBS "Use Boost static libraries" OFF)
endif()
find_package(Boost COMPONENTS ${boostLibs} REQUIRED)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
# hide Boost_DIR option that doesn't seem to be set by FindBoost
mark_as_advanced(Boost_DIR)
# no target
set(Boost_TARGET)

if(MSVC)
  # hide the warning generated by the usage of getenv()
  add_definitions(-D_CRT_SECURE_NO_WARNINGS)
  add_definitions(-D_SCL_SECURE_NO_WARNINGS)
endif(MSVC)

configure_file(config.h.in config.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

file(GLOB_RECURSE srcs *.cpp)
add_executable(vera ${srcs})
set_target_properties(vera PROPERTIES OUTPUT_NAME vera++)
target_link_libraries(vera
  ${TCL_LIBRARY}
  ${Boost_LIBRARIES})
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
   # keep it at the end to be able to build on ubuntu
  target_link_libraries(vera dl)
endif()