You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

498 lines
19 KiB

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