forked from exercism/cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
63 lines (61 loc) · 1.33 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
cmake_minimum_required(VERSION 2.8.11)
project(exercism CXX)
function(travis_fixup dir)
string(REPLACE "-" "_" file ${dir})
set(subdir ${CMAKE_CURRENT_SOURCE_DIR}/exercises/${dir})
if(EXISTS ${subdir}/example.h)
file(RENAME ${subdir}/example.h ${subdir}/${file}.h)
endif()
if(EXISTS ${subdir}/example.cpp)
file(RENAME ${subdir}/example.cpp ${subdir}/${file}.cpp)
endif()
endfunction()
foreach(exercise
bob
word-count
hamming
anagram
food-chain
beer-song
nucleotide-count
rna-transcription
phone-number
grade-school
robot-name
leap
etl
space-age
grains
gigasecond
triangle
clock
raindrops
difference-of-squares
roman-numerals
nth-prime
sieve
binary
sum-of-multiples
series
prime-factors
trinary
crypto-square
scrabble-score
hexadecimal
say
meetup
queen-attack
allergies
atbash-cipher
bracket-push
pangram
)
set(exercise_dir exercises/${exercise})
travis_fixup(${exercise})
execute_process(
COMMAND ${CMAKE_COMMAND} -DEXERCISM_RUN_ALL_TESTS:BOOL=1 -G ${CMAKE_GENERATOR} .
WORKING_DIRECTORY ${exercise_dir})
add_custom_target(${exercise} ALL
COMMAND ${CMAKE_COMMAND} --build .
WORKING_DIRECTORY ${exercise_dir})
endforeach()