Skip to content

Commit

Permalink
CMakeLists.txt now checks correctly for dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Barberio committed Mar 15, 2016
1 parent 20f3d14 commit e651e01
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
cmake_minimum_required (VERSION 2.8)
cmake_policy(SET CMP0048 NEW)
project (dublin-traceroute
VERSION 0.2)
project (dublin-traceroute)

set (dublin-traceroute_VERSION_MAJOR_1)
set (dublin-traceroute_VERSION_MINOR_0)
set (dublin-traceroute_VERSION_MAJOR_0)
set (dublin-traceroute_VERSION_MINOR_2)

include_directories("${PROJECT_SOURCE_DIR}/include")

Expand All @@ -15,18 +13,31 @@ add_library(dublintraceroute SHARED
src/traceroute_results.cc
)

find_package (Threads)
find_package(PkgConfig)
find_package(Threads REQUIRED)
find_package(libtins)
if (${libtins_FOUND})
MESSAGE(STATUS "libtins found via CMake")
else (${libtins_FOUND})
MESSAGE(STATUS "libtins not found via CMake, trying pkg-config")
pkg_search_module(libtins REQUIRED libtins)
endif (${libtins_FOUND})

pkg_search_module(JSONCPP REQUIRED jsoncpp)

add_executable(dublin-traceroute src/main.cc)
target_link_libraries (dublin-traceroute ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(dublin-traceroute dublintraceroute)
target_link_libraries(dublintraceroute tins)
target_link_libraries(dublintraceroute jsoncpp)

add_dependencies(dublin-traceroute dublintraceroute)
target_link_libraries(dublintraceroute ${JSONCPP_LIBRARIES} jsoncpp)
target_include_directories(dublintraceroute PUBLIC ${JSONCPP_INCLUDE_DIRS})

set_property(TARGET dublintraceroute PROPERTY CXX_STANDARD 11)
set_property(TARGET dublin-traceroute PROPERTY CXX_STANDARD 11)
#set_property(TARGET dublintraceroute PROPERTY CXX_STANDARD 11)
#set_property(TARGET dublintraceroute PROPERTY CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

add_dependencies(dublin-traceroute dublintraceroute)

install(TARGETS dublin-traceroute dublintraceroute
RUNTIME DESTINATION bin
Expand Down

0 comments on commit e651e01

Please sign in to comment.