Sha256: f96b70a236d3ec79a4fec809249eabb53b76710827535b909afbcf1a0df5769c

Contents?: true

Size: 1.79 KB

Versions: 5329

Compression:

Stored size: 1.79 KB

Contents

# Get the exercise name from the current directory
get_filename_component(exercise ${CMAKE_CURRENT_SOURCE_DIR} NAME)

# Basic CMake project
cmake_minimum_required(VERSION 2.8.11)

# Name the project after the exercise
project(${exercise} CXX)

# Locate Boost libraries: unit_test_framework, date_time and regex
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.55 REQUIRED COMPONENTS unit_test_framework date_time regex)

# Enable C++11 features on gcc/clang
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
    set(CMAKE_CXX_FLAGS "-std=c++11")
endif()

# Configure to run all the tests?
if(${EXERCISM_RUN_ALL_TESTS})
    add_definitions(-DEXERCISM_RUN_ALL_TESTS)
endif()

# Get a source filename from the exercise name by replacing -'s with _'s
string(REPLACE "-" "_" file ${exercise})

# Implementation could be only a header
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.cpp)
    set(exercise_cpp ${file}.cpp)
else()
    set(exercise_cpp "")
endif()

# Include a test helper header if it exists
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/require_equal_containers.h)
    set(test_helper require_equal_containers.h)
else()
    set(test_helper "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${test_helper} ${exercise_cpp} ${file}.h)

# We need boost includes
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})

# We need boost libraries
target_link_libraries(${exercise} ${Boost_LIBRARIES})

# Tell MSVC not to warn us about unchecked iterators in debug builds
if(${MSVC})
    set_target_properties(${exercise} PROPERTIES
        COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
endif()

# Run the tests on every build
add_custom_command(TARGET ${exercise} POST_BUILD COMMAND ${exercise})

Version data entries

5,329 entries across 156 versions & 1 rubygems

Version Path
trackler-2.1.0.0 tracks/cpp/exercises/grains/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/nucleotide-count/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/difference-of-squares/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/grade-school/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/hexadecimal/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/nth-prime/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/binary/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/crypto-square/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/food-chain/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/gigasecond/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/hamming/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/hello-world/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/leap/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/meetup/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/anagram/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/beer-song/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/bob/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/clock/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/etl/CMakeLists.txt
trackler-2.1.0.0 tracks/cpp/exercises/phone-number/CMakeLists.txt