mirror of
https://github.com/boostorg/hof.git
synced 2026-01-31 20:22:11 +00:00
121 lines
3.1 KiB
CMake
121 lines
3.1 KiB
CMake
cmake_minimum_required (VERSION 2.8)
|
|
project (Fit)
|
|
|
|
# The version number.
|
|
set (Fit_VERSION_MAJOR 0)
|
|
set (Fit_VERSION_MINOR 4)
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
enable_language(CXX)
|
|
|
|
if(CMAKE_HOST_APPLE)
|
|
check_cxx_compiler_flag("-stdlib=libc++" COMPILER_HAS_CXX_FLAG_libcxx)
|
|
if(COMPILER_HAS_CXX_FLAG_libcxx)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
|
endif()
|
|
endif()
|
|
|
|
set(ENABLE_CXXFLAGS_TO_CHECK
|
|
-std=gnu++1y
|
|
-std=c++1y
|
|
-std=gnu++11
|
|
-std=c++11
|
|
-std=gnu++0x
|
|
-std=c++0x)
|
|
|
|
foreach(flag ${ENABLE_CXXFLAGS_TO_CHECK})
|
|
string(REPLACE "-std=" "_" flag_var ${flag})
|
|
string(REPLACE "+" "x" flag_var ${flag_var})
|
|
check_cxx_compiler_flag("${flag}" COMPILER_HAS_CXX_FLAG${flag_var})
|
|
if(COMPILER_HAS_CXX_FLAG${flag_var})
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
|
break()
|
|
endif()
|
|
endforeach()
|
|
|
|
install (DIRECTORY include/fit DESTINATION include)
|
|
configure_file(fit.pc.in fit.pc)
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fit.pc DESTINATION lib/pkgconfig)
|
|
|
|
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -VV -C ${CMAKE_CFG_INTDIR})
|
|
|
|
macro(add_test_executable TEST_NAME)
|
|
add_executable (${TEST_NAME} EXCLUDE_FROM_ALL ${ARGN})
|
|
if(WIN32)
|
|
add_test(NAME ${TEST_NAME} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${TEST_NAME}${CMAKE_EXECUTABLE_SUFFIX})
|
|
else()
|
|
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
|
|
endif()
|
|
add_dependencies(check ${TEST_NAME})
|
|
set_tests_properties(${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED")
|
|
endmacro(add_test_executable)
|
|
|
|
macro(add_fit_test TEST_NAME)
|
|
add_test_executable(${TEST_NAME} test/${TEST_NAME}.cpp ${ARGN})
|
|
endmacro(add_fit_test)
|
|
|
|
include(CTest)
|
|
|
|
include_directories(include)
|
|
|
|
add_fit_test(alias)
|
|
add_fit_test(always)
|
|
add_fit_test(apply)
|
|
add_fit_test(apply_eval)
|
|
add_fit_test(arg)
|
|
add_fit_test(by)
|
|
add_fit_test(capture)
|
|
add_fit_test(combine)
|
|
add_fit_test(compose)
|
|
add_fit_test(compress)
|
|
add_fit_test(conditional)
|
|
add_fit_test(construct)
|
|
add_fit_test(filter)
|
|
add_fit_test(fix)
|
|
add_fit_test(flip)
|
|
add_fit_test(flow)
|
|
add_fit_test(function)
|
|
add_fit_test(identity)
|
|
add_fit_test(if)
|
|
add_fit_test(implicit)
|
|
add_fit_test(indirect)
|
|
add_fit_test(infix)
|
|
add_fit_test(is_callable)
|
|
add_fit_test(issue8)
|
|
add_fit_test(lambda)
|
|
add_fit_test(lazy)
|
|
add_fit_test(lift)
|
|
add_fit_test(limit)
|
|
add_fit_test(match)
|
|
add_fit_test(mutable)
|
|
add_fit_test(pack)
|
|
add_fit_test(partial)
|
|
add_fit_test(pipable)
|
|
add_fit_test(placeholders)
|
|
add_fit_test(repeat)
|
|
add_fit_test(repeat_while)
|
|
add_fit_test(result)
|
|
add_fit_test(returns)
|
|
add_fit_test(reveal)
|
|
add_fit_test(reverse_compress)
|
|
add_fit_test(rotate)
|
|
add_fit_test(static)
|
|
add_fit_test(static_def test/static_def2.cpp)
|
|
add_fit_test(tap)
|
|
add_fit_test(unpack)
|
|
|
|
set(BUILD_EXAMPLES on)
|
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9")
|
|
set(BUILD_EXAMPLES off)
|
|
endif()
|
|
endif()
|
|
|
|
if (BUILD_EXAMPLES)
|
|
file(GLOB EXAMPLES example/*.cpp)
|
|
foreach(EXAMPLE ${EXAMPLES})
|
|
get_filename_component(BASE_NAME ${EXAMPLE} NAME_WE)
|
|
add_test_executable(example-${BASE_NAME} ${EXAMPLE})
|
|
endforeach()
|
|
endif()
|