Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ matrix:
packages:
- clang-3.8

- env: COMPILER=clang++-7
- env:
- COMPILER=clang++-7
- EXERCISM_COMMON_CATCH=false
Comment thread
KevinWMatthews marked this conversation as resolved.
addons:
apt:
sources:
Expand All @@ -43,7 +45,7 @@ before_install:
- sudo add-apt-repository -y ppa:samuel-bachmann/boost
- sudo apt-get -y -d update
install:
- sudo apt-get -y install cmake3 ninja-build libboost-test1.60-dev libboost-date-time1.60-dev
- sudo apt-get -y install cmake3 ninja-build libboost-date-time1.60-dev
- export CXX=${COMPILER}
- ${CXX} --version
script:
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ function(travis_fixup exercise_dir alt_exercise_root)
endfunction()

option(EXERCISM_RUN_ALL_TESTS "Run all Exercism tests" On)
option(EXERCISM_COMMON_CATCH "Link against a common Catch2 main lib." On)

if(EXERCISM_COMMON_CATCH)
add_library(catchlib OBJECT test/tests-main.cpp)
set_target_properties(catchlib PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED OFF
CXX_EXTENSIONS OFF
)
endif()

file(GLOB exercise_list ${CMAKE_CURRENT_SOURCE_DIR}/exercises/*)

Expand Down
8 changes: 7 additions & 1 deletion bin/check-exercises.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ set -e
repo=$(cd "$(dirname "$0")/.." && pwd)

# Configure all the tests.
cmake -G Ninja "$repo"
if [ "$EXERCISM_COMMON_CATCH" == "false" ]; then
echo "Using bundled Catch main libraries."
cmake -G Ninja -DEXERCISM_COMMON_CATCH=OFF "$repo"
else
echo "Using a common Catch main library."
cmake -G Ninja "$repo"
fi
echo ""

if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
Expand Down
10 changes: 8 additions & 2 deletions exercises/acronym/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/all-your-base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/allergies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/anagram/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/atbash-cipher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/beer-song/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/binary-search-tree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/binary-search/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/binary/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/bob/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/clock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/crypto-square/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/difference-of-squares/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/etl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/food-chain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/gigasecond/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/grade-school/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/grains/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/hamming/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
10 changes: 8 additions & 2 deletions exercises/hello-world/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ else()
set(exercise_cpp "")
endif()

# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
CXX_STANDARD 11
Expand Down
Loading