blob: d9e22ab1a60ed14d2890f72f122d02f7c25fa6d3 [file] [log] [blame]
Narayan Kamathc981c482012-11-02 10:59:05 +00001
2macro(ei_add_property prop value)
3 get_property(previous GLOBAL PROPERTY ${prop})
4 if ((NOT previous) OR (previous STREQUAL ""))
5 set_property(GLOBAL PROPERTY ${prop} "${value}")
6 else()
7 set_property(GLOBAL PROPERTY ${prop} "${previous} ${value}")
8 endif()
9endmacro(ei_add_property)
10
11#internal. See documentation of ei_add_test for details.
12macro(ei_add_test_internal testname testname_with_suffix)
13 set(targetname ${testname_with_suffix})
14
15 set(filename ${testname}.cpp)
16 add_executable(${targetname} ${filename})
17 if (targetname MATCHES "^eigen2_")
18 add_dependencies(eigen2_buildtests ${targetname})
19 else()
20 add_dependencies(buildtests ${targetname})
21 endif()
22
23 if(EIGEN_NO_ASSERTION_CHECKING)
24 ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_NO_ASSERTION_CHECKING=1")
25 else(EIGEN_NO_ASSERTION_CHECKING)
26 if(EIGEN_DEBUG_ASSERTS)
27 ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_DEBUG_ASSERTS=1")
28 endif(EIGEN_DEBUG_ASSERTS)
29 endif(EIGEN_NO_ASSERTION_CHECKING)
30
31 ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_MAX_SIZE=${EIGEN_TEST_MAX_SIZE}")
32
33 ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_FUNC=${testname}")
34
35 if(MSVC AND NOT EIGEN_SPLIT_LARGE_TESTS)
36 ei_add_target_property(${targetname} COMPILE_FLAGS "/bigobj")
37 endif()
38
39 # let the user pass flags.
40 if(${ARGC} GREATER 2)
41 ei_add_target_property(${targetname} COMPILE_FLAGS "${ARGV2}")
42 endif(${ARGC} GREATER 2)
43
44 if(EIGEN_TEST_CUSTOM_CXX_FLAGS)
45 ei_add_target_property(${targetname} COMPILE_FLAGS "${EIGEN_TEST_CUSTOM_CXX_FLAGS}")
46 endif()
47
48 if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
49 target_link_libraries(${targetname} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
50 endif()
51 if(EXTERNAL_LIBS)
52 target_link_libraries(${targetname} ${EXTERNAL_LIBS})
53 endif()
54 if(EIGEN_TEST_CUSTOM_LINKER_FLAGS)
55 target_link_libraries(${targetname} ${EIGEN_TEST_CUSTOM_LINKER_FLAGS})
56 endif()
57
58 if(${ARGC} GREATER 3)
59 set(libs_to_link ${ARGV3})
60 # it could be that some cmake module provides a bad library string " " (just spaces),
61 # and that severely breaks target_link_libraries ("can't link to -l-lstdc++" errors).
62 # so we check for strings containing only spaces.
63 string(STRIP "${libs_to_link}" libs_to_link_stripped)
64 string(LENGTH "${libs_to_link_stripped}" libs_to_link_stripped_length)
65 if(${libs_to_link_stripped_length} GREATER 0)
66 # notice: no double quotes around ${libs_to_link} here. It may be a list.
67 target_link_libraries(${targetname} ${libs_to_link})
68 endif()
69 endif()
70
71 if(EIGEN_BIN_BASH_EXISTS)
72 add_test(${testname_with_suffix} "${Eigen_SOURCE_DIR}/test/runtest.sh" "${testname_with_suffix}")
73 else()
74 add_test(${testname_with_suffix} "${targetname}")
75 endif()
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -070076
77 # Specify target and test labels accoirding to EIGEN_CURRENT_SUBPROJECT
78 get_property(current_subproject GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT)
79 if ((current_subproject) AND (NOT (current_subproject STREQUAL "")))
80 set_property(TARGET ${targetname} PROPERTY LABELS "Build${current_subproject}")
81 add_dependencies("Build${current_subproject}" ${targetname})
82 set_property(TEST ${testname_with_suffix} PROPERTY LABELS "${current_subproject}")
83 endif()
Narayan Kamathc981c482012-11-02 10:59:05 +000084
85endmacro(ei_add_test_internal)
86
87# Macro to add a test
88#
89# the unique mandatory parameter testname must correspond to a file
90# <testname>.cpp which follows this pattern:
91#
92# #include "main.h"
93# void test_<testname>() { ... }
94#
95# Depending on the contents of that file, this macro can have 2 behaviors,
96# see below.
97#
98# The optional 2nd parameter is libraries to link to.
99#
100# A. Default behavior
101#
102# this macro adds an executable <testname> as well as a ctest test
103# named <testname> too.
104#
105# On platforms with bash simply run:
106# "ctest -V" or "ctest -V -R <testname>"
107# On other platform use ctest as usual
108#
109# B. Multi-part behavior
110#
111# If the source file matches the regexp
112# CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+
113# then it is interpreted as a multi-part test. The behavior then depends on the
114# CMake option EIGEN_SPLIT_LARGE_TESTS, which is ON by default.
115#
116# If EIGEN_SPLIT_LARGE_TESTS is OFF, the behavior is the same as in A (the multi-part
117# aspect is ignored).
118#
119# If EIGEN_SPLIT_LARGE_TESTS is ON, the test is split into multiple executables
120# test_<testname>_<N>
121# where N runs from 1 to the greatest occurence found in the source file. Each of these
122# executables is built passing -DEIGEN_TEST_PART_N. This allows to split large tests
123# into smaller executables.
124#
125# Moreover, targets <testname> are still generated, they
126# have the effect of building all the parts of the test.
127#
128# Again, ctest -R allows to run all matching tests.
129macro(ei_add_test testname)
130 get_property(EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST)
131 set(EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}${testname}\n")
132 set_property(GLOBAL PROPERTY EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}")
133
134 file(READ "${testname}.cpp" test_source)
135 set(parts 0)
136 string(REGEX MATCHALL "CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+|EIGEN_SUFFIXES(;[0-9]+)+"
137 occurences "${test_source}")
138 string(REGEX REPLACE "CALL_SUBTEST_|EIGEN_TEST_PART_|EIGEN_SUFFIXES" "" suffixes "${occurences}")
139 list(REMOVE_DUPLICATES suffixes)
140 if(EIGEN_SPLIT_LARGE_TESTS AND suffixes)
141 add_custom_target(${testname})
142 foreach(suffix ${suffixes})
143 ei_add_test_internal(${testname} ${testname}_${suffix}
144 "${ARGV1} -DEIGEN_TEST_PART_${suffix}=1" "${ARGV2}")
145 add_dependencies(${testname} ${testname}_${suffix})
146 endforeach(suffix)
147 else(EIGEN_SPLIT_LARGE_TESTS AND suffixes)
148 set(symbols_to_enable_all_parts "")
149 foreach(suffix ${suffixes})
150 set(symbols_to_enable_all_parts
151 "${symbols_to_enable_all_parts} -DEIGEN_TEST_PART_${suffix}=1")
152 endforeach(suffix)
153 ei_add_test_internal(${testname} ${testname} "${ARGV1} ${symbols_to_enable_all_parts}" "${ARGV2}")
154 endif(EIGEN_SPLIT_LARGE_TESTS AND suffixes)
155endmacro(ei_add_test)
156
157
158# adds a failtest, i.e. a test that succeed if the program fails to compile
159# note that the test runner for these is CMake itself, when passed -DEIGEN_FAILTEST=ON
160# so here we're just running CMake commands immediately, we're not adding any targets.
161macro(ei_add_failtest testname)
162 get_property(EIGEN_FAILTEST_FAILURE_COUNT GLOBAL PROPERTY EIGEN_FAILTEST_FAILURE_COUNT)
163 get_property(EIGEN_FAILTEST_COUNT GLOBAL PROPERTY EIGEN_FAILTEST_COUNT)
164
165 message(STATUS "Checking failtest: ${testname}")
166 set(filename "${testname}.cpp")
167 file(READ "${filename}" test_source)
168
169 try_compile(succeeds_when_it_should_fail
170 "${CMAKE_CURRENT_BINARY_DIR}"
171 "${CMAKE_CURRENT_SOURCE_DIR}/${filename}"
172 COMPILE_DEFINITIONS "-DEIGEN_SHOULD_FAIL_TO_BUILD")
173 if (succeeds_when_it_should_fail)
174 message(STATUS "FAILED: ${testname} build succeeded when it should have failed")
175 endif()
176
177 try_compile(succeeds_when_it_should_succeed
178 "${CMAKE_CURRENT_BINARY_DIR}"
179 "${CMAKE_CURRENT_SOURCE_DIR}/${filename}"
180 COMPILE_DEFINITIONS)
181 if (NOT succeeds_when_it_should_succeed)
182 message(STATUS "FAILED: ${testname} build failed when it should have succeeded")
183 endif()
184
185 if (succeeds_when_it_should_fail OR NOT succeeds_when_it_should_succeed)
186 math(EXPR EIGEN_FAILTEST_FAILURE_COUNT ${EIGEN_FAILTEST_FAILURE_COUNT}+1)
187 endif()
188
189 math(EXPR EIGEN_FAILTEST_COUNT ${EIGEN_FAILTEST_COUNT}+1)
190
191 set_property(GLOBAL PROPERTY EIGEN_FAILTEST_FAILURE_COUNT ${EIGEN_FAILTEST_FAILURE_COUNT})
192 set_property(GLOBAL PROPERTY EIGEN_FAILTEST_COUNT ${EIGEN_FAILTEST_COUNT})
193endmacro(ei_add_failtest)
194
195# print a summary of the different options
196macro(ei_testing_print_summary)
197 message(STATUS "************************************************************")
198 message(STATUS "*** Eigen's unit tests configuration summary ***")
199 message(STATUS "************************************************************")
200 message(STATUS "")
201 message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
202 message(STATUS "Build site: ${SITE}")
203 message(STATUS "Build string: ${BUILDNAME}")
204 get_property(EIGEN_TESTING_SUMMARY GLOBAL PROPERTY EIGEN_TESTING_SUMMARY)
205 get_property(EIGEN_TESTED_BACKENDS GLOBAL PROPERTY EIGEN_TESTED_BACKENDS)
206 get_property(EIGEN_MISSING_BACKENDS GLOBAL PROPERTY EIGEN_MISSING_BACKENDS)
207 message(STATUS "Enabled backends: ${EIGEN_TESTED_BACKENDS}")
208 message(STATUS "Disabled backends: ${EIGEN_MISSING_BACKENDS}")
209
210 if(EIGEN_DEFAULT_TO_ROW_MAJOR)
211 message(STATUS "Default order: Row-major")
212 else()
213 message(STATUS "Default order: Column-major")
214 endif()
215
216 if(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT)
217 message(STATUS "Explicit alignment (hence vectorization) disabled")
218 elseif(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)
219 message(STATUS "Explicit vectorization disabled (alignment kept enabled)")
220 else()
221
222 message(STATUS "Maximal matrix/vector size: ${EIGEN_TEST_MAX_SIZE}")
223
224 if(EIGEN_TEST_SSE2)
225 message(STATUS "SSE2: ON")
226 else()
227 message(STATUS "SSE2: Using architecture defaults")
228 endif()
229
230 if(EIGEN_TEST_SSE3)
231 message(STATUS "SSE3: ON")
232 else()
233 message(STATUS "SSE3: Using architecture defaults")
234 endif()
235
236 if(EIGEN_TEST_SSSE3)
237 message(STATUS "SSSE3: ON")
238 else()
239 message(STATUS "SSSE3: Using architecture defaults")
240 endif()
241
242 if(EIGEN_TEST_SSE4_1)
243 message(STATUS "SSE4.1: ON")
244 else()
245 message(STATUS "SSE4.1: Using architecture defaults")
246 endif()
247
248 if(EIGEN_TEST_SSE4_2)
249 message(STATUS "SSE4.2: ON")
250 else()
251 message(STATUS "SSE4.2: Using architecture defaults")
252 endif()
253
254 if(EIGEN_TEST_ALTIVEC)
255 message(STATUS "Altivec: ON")
256 else()
257 message(STATUS "Altivec: Using architecture defaults")
258 endif()
259
260 if(EIGEN_TEST_NEON)
261 message(STATUS "ARM NEON: ON")
262 else()
263 message(STATUS "ARM NEON: Using architecture defaults")
264 endif()
265
266 endif() # vectorization / alignment options
267
268 message(STATUS "\n${EIGEN_TESTING_SUMMARY}")
269
270 message(STATUS "************************************************************")
271endmacro(ei_testing_print_summary)
272
273macro(ei_init_testing)
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -0700274 define_property(GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT BRIEF_DOCS " " FULL_DOCS " ")
Narayan Kamathc981c482012-11-02 10:59:05 +0000275 define_property(GLOBAL PROPERTY EIGEN_TESTED_BACKENDS BRIEF_DOCS " " FULL_DOCS " ")
276 define_property(GLOBAL PROPERTY EIGEN_MISSING_BACKENDS BRIEF_DOCS " " FULL_DOCS " ")
277 define_property(GLOBAL PROPERTY EIGEN_TESTING_SUMMARY BRIEF_DOCS " " FULL_DOCS " ")
278 define_property(GLOBAL PROPERTY EIGEN_TESTS_LIST BRIEF_DOCS " " FULL_DOCS " ")
279
280 set_property(GLOBAL PROPERTY EIGEN_TESTED_BACKENDS "")
281 set_property(GLOBAL PROPERTY EIGEN_MISSING_BACKENDS "")
282 set_property(GLOBAL PROPERTY EIGEN_TESTING_SUMMARY "")
283 set_property(GLOBAL PROPERTY EIGEN_TESTS_LIST "")
284
285 define_property(GLOBAL PROPERTY EIGEN_FAILTEST_FAILURE_COUNT BRIEF_DOCS " " FULL_DOCS " ")
286 define_property(GLOBAL PROPERTY EIGEN_FAILTEST_COUNT BRIEF_DOCS " " FULL_DOCS " ")
287
288 set_property(GLOBAL PROPERTY EIGEN_FAILTEST_FAILURE_COUNT "0")
289 set_property(GLOBAL PROPERTY EIGEN_FAILTEST_COUNT "0")
290
291 # uncomment anytime you change the ei_get_compilerver_from_cxx_version_string macro
292 # ei_test_get_compilerver_from_cxx_version_string()
293endmacro(ei_init_testing)
294
295macro(ei_set_sitename)
296 # if the sitename is not yet set, try to set it
297 if(NOT ${SITE} OR ${SITE} STREQUAL "")
298 set(eigen_computername $ENV{COMPUTERNAME})
299 set(eigen_hostname $ENV{HOSTNAME})
300 if(eigen_hostname)
301 set(SITE ${eigen_hostname})
302 elseif(eigen_computername)
303 set(SITE ${eigen_computername})
304 endif()
305 endif()
306 # in case it is already set, enforce lower case
307 if(SITE)
308 string(TOLOWER ${SITE} SITE)
309 endif()
310endmacro(ei_set_sitename)
311
312macro(ei_get_compilerver VAR)
313 if(MSVC)
314 # on windows system, we use a modified CMake script
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -0700315 include(EigenDetermineVSServicePack)
316 EigenDetermineVSServicePack( my_service_pack )
Narayan Kamathc981c482012-11-02 10:59:05 +0000317
318 if( my_service_pack )
319 set(${VAR} ${my_service_pack})
320 else()
321 set(${VAR} "na")
322 endif()
323 else()
324 # on all other system we rely on ${CMAKE_CXX_COMPILER}
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -0700325 # supporting a "--version" flag
Narayan Kamathc981c482012-11-02 10:59:05 +0000326
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -0700327 # check whether the head command exists
328 find_program(HEAD_EXE head NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH)
329 if(HEAD_EXE)
330 execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version
331 COMMAND head -n 1
332 OUTPUT_VARIABLE eigen_cxx_compiler_version_string OUTPUT_STRIP_TRAILING_WHITESPACE)
333 else()
334 execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version
335 OUTPUT_VARIABLE eigen_cxx_compiler_version_string OUTPUT_STRIP_TRAILING_WHITESPACE)
336 string(REGEX REPLACE "[\n\r].*" "" eigen_cxx_compiler_version_string ${eigen_cxx_compiler_version_string})
337 endif()
Narayan Kamathc981c482012-11-02 10:59:05 +0000338
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -0700339 ei_get_compilerver_from_cxx_version_string("${eigen_cxx_compiler_version_string}" CNAME CVER)
Narayan Kamathc981c482012-11-02 10:59:05 +0000340 set(${VAR} "${CNAME}-${CVER}")
341 endif()
342endmacro(ei_get_compilerver)
343
344# Extract compiler name and version from a raw version string
345# WARNING: if you edit thid macro, then please test it by uncommenting
346# the testing macro call in ei_init_testing() of the EigenTesting.cmake file.
347# See also the ei_test_get_compilerver_from_cxx_version_string macro at the end of the file
348macro(ei_get_compilerver_from_cxx_version_string VERSTRING CNAME CVER)
349 # extract possible compiler names
350 string(REGEX MATCH "g\\+\\+" ei_has_gpp ${VERSTRING})
351 string(REGEX MATCH "llvm|LLVM" ei_has_llvm ${VERSTRING})
352 string(REGEX MATCH "gcc|GCC" ei_has_gcc ${VERSTRING})
353 string(REGEX MATCH "icpc|ICC" ei_has_icpc ${VERSTRING})
354 string(REGEX MATCH "clang|CLANG" ei_has_clang ${VERSTRING})
355
356 # combine them
357 if((ei_has_llvm) AND (ei_has_gpp OR ei_has_gcc))
358 set(${CNAME} "llvm-g++")
359 elseif((ei_has_llvm) AND (ei_has_clang))
360 set(${CNAME} "llvm-clang++")
361 elseif(ei_has_icpc)
362 set(${CNAME} "icpc")
363 elseif(ei_has_gpp OR ei_has_gcc)
364 set(${CNAME} "g++")
365 else()
366 set(${CNAME} "_")
367 endif()
368
369 # extract possible version numbers
370 # first try to extract 3 isolated numbers:
371 string(REGEX MATCH " [0-9]+\\.[0-9]+\\.[0-9]+" eicver ${VERSTRING})
372 if(NOT eicver)
373 # try to extract 2 isolated ones:
374 string(REGEX MATCH " [0-9]+\\.[0-9]+" eicver ${VERSTRING})
375 if(NOT eicver)
376 # try to extract 3:
377 string(REGEX MATCH "[^0-9][0-9]+\\.[0-9]+\\.[0-9]+" eicver ${VERSTRING})
378 if(NOT eicver)
379 # try to extract 2:
380 string(REGEX MATCH "[^0-9][0-9]+\\.[0-9]+" eicver ${VERSTRING})
381 else()
382 set(eicver " _")
383 endif()
384 endif()
385 endif()
386
387 string(REGEX REPLACE ".(.*)" "\\1" ${CVER} ${eicver})
388
389endmacro(ei_get_compilerver_from_cxx_version_string)
390
391macro(ei_get_cxxflags VAR)
392 set(${VAR} "")
393 ei_is_64bit_env(IS_64BIT_ENV)
394 if(EIGEN_TEST_NEON)
395 set(${VAR} NEON)
396 elseif(EIGEN_TEST_ALTIVEC)
397 set(${VAR} ALVEC)
398 elseif(EIGEN_TEST_SSE4_2)
399 set(${VAR} SSE42)
400 elseif(EIGEN_TEST_SSE4_1)
401 set(${VAR} SSE41)
402 elseif(EIGEN_TEST_SSSE3)
403 set(${VAR} SSSE3)
404 elseif(EIGEN_TEST_SSE3)
405 set(${VAR} SSE3)
406 elseif(EIGEN_TEST_SSE2 OR IS_64BIT_ENV)
407 set(${VAR} SSE2)
408 endif()
409
410 if(EIGEN_TEST_OPENMP)
411 if (${VAR} STREQUAL "")
412 set(${VAR} OMP)
413 else()
414 set(${VAR} ${${VAR}}-OMP)
415 endif()
416 endif()
417
418 if(EIGEN_DEFAULT_TO_ROW_MAJOR)
419 if (${VAR} STREQUAL "")
420 set(${VAR} ROW)
421 else()
422 set(${VAR} ${${VAR}}-ROWMAJ)
423 endif()
424 endif()
425endmacro(ei_get_cxxflags)
426
427macro(ei_set_build_string)
428 ei_get_compilerver(LOCAL_COMPILER_VERSION)
429 ei_get_cxxflags(LOCAL_COMPILER_FLAGS)
430
431 include(EigenDetermineOSVersion)
432 DetermineOSVersion(OS_VERSION)
433
434 set(TMP_BUILD_STRING ${OS_VERSION}-${LOCAL_COMPILER_VERSION})
435
436 if (NOT ${LOCAL_COMPILER_FLAGS} STREQUAL "")
437 set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-${LOCAL_COMPILER_FLAGS})
438 endif()
439
440 ei_is_64bit_env(IS_64BIT_ENV)
441 if(NOT IS_64BIT_ENV)
442 set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-32bit)
443 else()
444 set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-64bit)
445 endif()
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -0700446
447 if(EIGEN_BUILD_STRING_SUFFIX)
448 set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-${EIGEN_BUILD_STRING_SUFFIX})
449 endif()
Narayan Kamathc981c482012-11-02 10:59:05 +0000450
451 string(TOLOWER ${TMP_BUILD_STRING} BUILDNAME)
452endmacro(ei_set_build_string)
453
454macro(ei_is_64bit_env VAR)
455
456 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/is64.cpp"
457 "int main() { return (sizeof(int*) == 8 ? 1 : 0); }
458 ")
459 try_run(run_res compile_res
460 ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/is64.cpp"
461 RUN_OUTPUT_VARIABLE run_output)
462
463 if(compile_res AND run_res)
464 set(${VAR} ${run_res})
465 elseif(CMAKE_CL_64)
466 set(${VAR} 1)
467 elseif("$ENV{Platform}" STREQUAL "X64") # nmake 64 bit
468 set(${VAR} 1)
469 endif()
470endmacro(ei_is_64bit_env)
471
472
473# helper macro for testing ei_get_compilerver_from_cxx_version_string
474# STR: raw version string
475# REFNAME: expected compiler name
476# REFVER: expected compiler version
477macro(ei_test1_get_compilerver_from_cxx_version_string STR REFNAME REFVER)
478 ei_get_compilerver_from_cxx_version_string(${STR} CNAME CVER)
479 if((NOT ${REFNAME} STREQUAL ${CNAME}) OR (NOT ${REFVER} STREQUAL ${CVER}))
480 message("STATUS ei_get_compilerver_from_cxx_version_string error:")
481 message("Expected \"${REFNAME}-${REFVER}\", got \"${CNAME}-${CVER}\"")
482 endif()
483endmacro(ei_test1_get_compilerver_from_cxx_version_string)
484
485# macro for testing ei_get_compilerver_from_cxx_version_string
486# feel free to add more version strings
487macro(ei_test_get_compilerver_from_cxx_version_string)
488 ei_test1_get_compilerver_from_cxx_version_string("g++ (SUSE Linux) 4.5.3 20110428 [gcc-4_5-branch revision 173117]" "g++" "4.5.3")
489 ei_test1_get_compilerver_from_cxx_version_string("c++ (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)" "g++" "4.5.1")
490 ei_test1_get_compilerver_from_cxx_version_string("icpc (ICC) 11.0 20081105" "icpc" "11.0")
491 ei_test1_get_compilerver_from_cxx_version_string("g++-3.4 (GCC) 3.4.6" "g++" "3.4.6")
492 ei_test1_get_compilerver_from_cxx_version_string("SUSE Linux clang version 3.0 (branches/release_30 145598) (based on LLVM 3.0)" "llvm-clang++" "3.0")
493 ei_test1_get_compilerver_from_cxx_version_string("icpc (ICC) 12.0.5 20110719" "icpc" "12.0.5")
494 ei_test1_get_compilerver_from_cxx_version_string("Apple clang version 2.1 (tags/Apple/clang-163.7.1) (based on LLVM 3.0svn)" "llvm-clang++" "2.1")
495 ei_test1_get_compilerver_from_cxx_version_string("i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)" "llvm-g++" "4.2.1")
496 ei_test1_get_compilerver_from_cxx_version_string("g++-mp-4.4 (GCC) 4.4.6" "g++" "4.4.6")
497 ei_test1_get_compilerver_from_cxx_version_string("g++-mp-4.4 (GCC) 2011" "g++" "4.4")
498endmacro(ei_test_get_compilerver_from_cxx_version_string)