Commit 137e31b7 authored by Dominik Charousset's avatar Dominik Charousset

CMake tweaks to reduce verbosity of CMake files

parent 781f013d
...@@ -233,6 +233,10 @@ add_subdirectory(unit_testing) ...@@ -233,6 +233,10 @@ add_subdirectory(unit_testing)
add_subdirectory(examples) add_subdirectory(examples)
add_subdirectory(benchmarks) add_subdirectory(benchmarks)
add_dependencies(all_examples libcppa)
add_dependencies(all_unit_tests libcppa)
add_dependencies(all_benchmarks libcppa)
# set optional flags # set optional flags
string(TOUPPER ${CMAKE_BUILD_TYPE} build_type) string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
set(CONTEXT_SWITCHING true) set(CONTEXT_SWITCHING true)
......
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
project(cppa_benchmarks CXX) project(cppa_benchmarks CXX)
# Set up environment paths to cmake modules and libcppa add_custom_target(all_benchmarks)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) include_directories(.)
add_executable(actor_creation cppa/actor_creation.cpp) macro(add_benchmark name)
add_executable(mailbox_performance cppa/mailbox_performance.cpp) add_executable(${name} cppa/${name}.cpp)
add_executable(mixed_case cppa/mixed_case.cpp) target_link_libraries(${name} ${CMAKE_DL_LIBS} ${CPPA_LIBRARY} ${PTHREAD_LIBRARIES})
add_executable(distributed cppa/distributed.cpp) add_dependencies(${name} all_benchmarks)
add_executable(matching cppa/matching.cpp) endmacro()
# search for libs add_benchmark(actor_creation)
if(NOT cppa_LIBRARY) add_benchmark(mailbox_performance)
find_package(Libcppa REQUIRED) add_benchmark(mixed_case)
endif (NOT cppa_LIBRARY) add_benchmark(distributed)
add_benchmark(matching)
find_package(Boost REQUIRED)
find_package(PTHREAD REQUIRED)
link_directories(${Boost_LIBRARY_DIRS})
include_directories(. ${cppa_INCLUDE} ${Boost_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR})
set(benchmark_LIBS ${CMAKE_DL_LIBS} ${CPPA_LIBRARY} ${Boost_THREAD_LIBRARY} ${PTHREAD_LIBRARIES})
target_link_libraries(actor_creation ${benchmark_LIBS})
target_link_libraries(mailbox_performance ${benchmark_LIBS})
target_link_libraries(mixed_case ${benchmark_LIBS})
target_link_libraries(distributed ${benchmark_LIBS})
target_link_libraries(matching ${benchmark_LIBS})
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
project(cppa_examples CXX) project(cppa_examples CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wextra -Wall -pedantic") add_custom_target(all_examples)
# Set up environment paths to cmake modules and libcppa
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
include_directories(. ${CPPA_INCLUDE} ${Boost_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR})
macro(add_example name) macro(add_example name)
add_executable(${name} ${name}.cpp ${ARGN}) add_executable(${name} ${name}.cpp ${ARGN})
target_link_libraries(${name} ${CMAKE_DL_LIBS} ${CPPA_LIBRARY} ${PTHREAD_LIBRARIES}) target_link_libraries(${name} ${CMAKE_DL_LIBS} ${CPPA_LIBRARY} ${PTHREAD_LIBRARIES})
add_dependencies(${name} libcppa) add_dependencies(${name} all_examples)
endmacro() endmacro()
add_example(announce_example_1) add_example(announce_example_1)
......
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
project(cppa_unit_tests CXX) project(cppa_unit_tests CXX)
add_custom_target(all_unit_tests)
# set up environment paths to cmake modules and libcppa
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# search for libs
if(NOT cppa_LIBRARY)
find_package(Libcppa REQUIRED)
endif (NOT cppa_LIBRARY)
#find_package(Boost COMPONENTS thread REQUIRED)
find_package(Boost REQUIRED)
find_package(PTHREAD REQUIRED)
link_directories(${Boost_LIBRARY_DIRS})
include_directories(. ${cppa_INCLUDE} ${Boost_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR})
set(EXAMPLE_LIBS ${CMAKE_DL_LIBS} ${CPPA_LIBRARY} ${PTHREAD_LIBRARIES})
macro(add_unit_test name) macro(add_unit_test name)
add_executable(test__${name} test__${name}.cpp ${ARGN}) add_executable(test__${name} test__${name}.cpp ${ARGN})
target_link_libraries(test__${name} ${EXAMPLE_LIBS} ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(test__${name} ${CMAKE_DL_LIBS} ${CPPA_LIBRARY} ${PTHREAD_LIBRARIES})
add_test(${name} ${EXECUTABLE_OUTPUT_PATH}/test__${name}) add_test(${name} ${EXECUTABLE_OUTPUT_PATH}/test__${name})
add_dependencies(test__${name} libcppa) add_dependencies(test__${name} all_unit_tests)
endmacro() endmacro()
add_unit_test(ripemd_160) add_unit_test(ripemd_160)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment