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.

491 lines
19 KiB

  1. project(Eigen)
  2. cmake_minimum_required(VERSION 2.8.5)
  3. # guard against in-source builds
  4. if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
  5. message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ")
  6. endif()
  7. # guard against bad build-type strings
  8. if (NOT CMAKE_BUILD_TYPE)
  9. set(CMAKE_BUILD_TYPE "Release")
  10. endif()
  11. string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower)
  12. if( NOT cmake_build_type_tolower STREQUAL "debug"
  13. AND NOT cmake_build_type_tolower STREQUAL "release"
  14. AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo")
  15. message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).")
  16. endif()
  17. #############################################################################
  18. # retrieve version infomation #
  19. #############################################################################
  20. # automatically parse the version number
  21. file(READ "${PROJECT_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen_version_header)
  22. string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}")
  23. set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}")
  24. string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}")
  25. set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}")
  26. string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}")
  27. set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}")
  28. set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})
  29. # if the mercurial program is absent, this will leave the EIGEN_HG_CHANGESET string empty,
  30. # but won't stop CMake.
  31. execute_process(COMMAND hg tip -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_HGTIP_OUTPUT)
  32. execute_process(COMMAND hg branch -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_BRANCH_OUTPUT)
  33. # if this is the default (aka development) branch, extract the mercurial changeset number from the hg tip output...
  34. if(EIGEN_BRANCH_OUTPUT MATCHES "default")
  35. string(REGEX MATCH "^changeset: *[0-9]*:([0-9;a-f]+).*" EIGEN_HG_CHANGESET_MATCH "${EIGEN_HGTIP_OUTPUT}")
  36. set(EIGEN_HG_CHANGESET "${CMAKE_MATCH_1}")
  37. endif(EIGEN_BRANCH_OUTPUT MATCHES "default")
  38. #...and show it next to the version number
  39. if(EIGEN_HG_CHANGESET)
  40. set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER} (mercurial changeset ${EIGEN_HG_CHANGESET})")
  41. else(EIGEN_HG_CHANGESET)
  42. set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER}")
  43. endif(EIGEN_HG_CHANGESET)
  44. include(CheckCXXCompilerFlag)
  45. include(GNUInstallDirs)
  46. set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
  47. #############################################################################
  48. # find how to link to the standard libraries #
  49. #############################################################################
  50. find_package(StandardMathLibrary)
  51. set(EIGEN_TEST_CUSTOM_LINKER_FLAGS "" CACHE STRING "Additional linker flags when linking unit tests.")
  52. set(EIGEN_TEST_CUSTOM_CXX_FLAGS "" CACHE STRING "Additional compiler flags when compiling unit tests.")
  53. set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "")
  54. if(NOT STANDARD_MATH_LIBRARY_FOUND)
  55. message(FATAL_ERROR
  56. "Can't link to the standard math library. Please report to the Eigen developers, telling them about your platform.")
  57. else()
  58. if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
  59. set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${STANDARD_MATH_LIBRARY}")
  60. else()
  61. set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${STANDARD_MATH_LIBRARY}")
  62. endif()
  63. endif()
  64. if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
  65. message(STATUS "Standard libraries to link to explicitly: ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}")
  66. else()
  67. message(STATUS "Standard libraries to link to explicitly: none")
  68. endif()
  69. option(EIGEN_BUILD_BTL "Build benchmark suite" OFF)
  70. if(NOT WIN32)
  71. option(EIGEN_BUILD_PKGCONFIG "Build pkg-config .pc file for Eigen" ON)
  72. endif(NOT WIN32)
  73. set(CMAKE_INCLUDE_CURRENT_DIR ON)
  74. option(EIGEN_SPLIT_LARGE_TESTS "Split large tests into smaller executables" ON)
  75. option(EIGEN_DEFAULT_TO_ROW_MAJOR "Use row-major as default matrix storage order" OFF)
  76. if(EIGEN_DEFAULT_TO_ROW_MAJOR)
  77. add_definitions("-DEIGEN_DEFAULT_TO_ROW_MAJOR")
  78. endif()
  79. set(EIGEN_TEST_MAX_SIZE "320" CACHE STRING "Maximal matrix/vector size, default is 320")
  80. macro(ei_add_cxx_compiler_flag FLAG)
  81. string(REGEX REPLACE "-" "" SFLAG1 ${FLAG})
  82. string(REGEX REPLACE "\\+" "p" SFLAG ${SFLAG1})
  83. check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG})
  84. if(COMPILER_SUPPORT_${SFLAG})
  85. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}")
  86. endif()
  87. endmacro(ei_add_cxx_compiler_flag)
  88. if(NOT MSVC)
  89. # We assume that other compilers are partly compatible with GNUCC
  90. # clang outputs some warnings for unknwon flags that are not caught by check_cxx_compiler_flag
  91. # adding -Werror turns such warnings into errors
  92. check_cxx_compiler_flag("-Werror" COMPILER_SUPPORT_WERROR)
  93. if(COMPILER_SUPPORT_WERROR)
  94. set(CMAKE_REQUIRED_FLAGS "-Werror")
  95. endif()
  96. ei_add_cxx_compiler_flag("-pedantic")
  97. ei_add_cxx_compiler_flag("-Wall")
  98. ei_add_cxx_compiler_flag("-Wextra")
  99. #ei_add_cxx_compiler_flag("-Weverything") # clang
  100. ei_add_cxx_compiler_flag("-Wundef")
  101. ei_add_cxx_compiler_flag("-Wcast-align")
  102. ei_add_cxx_compiler_flag("-Wchar-subscripts")
  103. ei_add_cxx_compiler_flag("-Wnon-virtual-dtor")
  104. ei_add_cxx_compiler_flag("-Wunused-local-typedefs")
  105. ei_add_cxx_compiler_flag("-Wpointer-arith")
  106. ei_add_cxx_compiler_flag("-Wwrite-strings")
  107. ei_add_cxx_compiler_flag("-Wformat-security")
  108. ei_add_cxx_compiler_flag("-Wshorten-64-to-32")
  109. ei_add_cxx_compiler_flag("-Wenum-conversion")
  110. ei_add_cxx_compiler_flag("-Wc++11-extensions")
  111. # -Wshadow is insanely too strict with gcc, hopefully it will become usable with gcc 6
  112. # if(NOT CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.0.0"))
  113. if(NOT CMAKE_COMPILER_IS_GNUCXX)
  114. ei_add_cxx_compiler_flag("-Wshadow")
  115. endif()
  116. ei_add_cxx_compiler_flag("-Wno-psabi")
  117. ei_add_cxx_compiler_flag("-Wno-variadic-macros")
  118. ei_add_cxx_compiler_flag("-Wno-long-long")
  119. ei_add_cxx_compiler_flag("-fno-check-new")
  120. ei_add_cxx_compiler_flag("-fno-common")
  121. ei_add_cxx_compiler_flag("-fstrict-aliasing")
  122. ei_add_cxx_compiler_flag("-wd981") # disable ICC's "operands are evaluated in unspecified order" remark
  123. ei_add_cxx_compiler_flag("-wd2304") # disbale ICC's "warning #2304: non-explicit constructor with single argument may cause implicit type conversion" produced by -Wnon-virtual-dtor
  124. # The -ansi flag must be added last, otherwise it is also used as a linker flag by check_cxx_compiler_flag making it fails
  125. # Moreover we should not set both -strict-ansi and -ansi
  126. check_cxx_compiler_flag("-strict-ansi" COMPILER_SUPPORT_STRICTANSI)
  127. ei_add_cxx_compiler_flag("-Qunused-arguments") # disable clang warning: argument unused during compilation: '-ansi'
  128. if(COMPILER_SUPPORT_STRICTANSI)
  129. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -strict-ansi")
  130. else()
  131. ei_add_cxx_compiler_flag("-ansi")
  132. endif()
  133. if(ANDROID_NDK)
  134. ei_add_cxx_compiler_flag("-pie")
  135. ei_add_cxx_compiler_flag("-fPIE")
  136. endif()
  137. set(CMAKE_REQUIRED_FLAGS "")
  138. option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF)
  139. if(EIGEN_TEST_SSE2)
  140. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
  141. message(STATUS "Enabling SSE2 in tests/examples")
  142. endif()
  143. option(EIGEN_TEST_SSE3 "Enable/Disable SSE3 in tests/examples" OFF)
  144. if(EIGEN_TEST_SSE3)
  145. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3")
  146. message(STATUS "Enabling SSE3 in tests/examples")
  147. endif()
  148. option(EIGEN_TEST_SSSE3 "Enable/Disable SSSE3 in tests/examples" OFF)
  149. if(EIGEN_TEST_SSSE3)
  150. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3")
  151. message(STATUS "Enabling SSSE3 in tests/examples")
  152. endif()
  153. option(EIGEN_TEST_SSE4_1 "Enable/Disable SSE4.1 in tests/examples" OFF)
  154. if(EIGEN_TEST_SSE4_1)
  155. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
  156. message(STATUS "Enabling SSE4.1 in tests/examples")
  157. endif()
  158. option(EIGEN_TEST_SSE4_2 "Enable/Disable SSE4.2 in tests/examples" OFF)
  159. if(EIGEN_TEST_SSE4_2)
  160. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2")
  161. message(STATUS "Enabling SSE4.2 in tests/examples")
  162. endif()
  163. option(EIGEN_TEST_AVX "Enable/Disable AVX in tests/examples" OFF)
  164. if(EIGEN_TEST_AVX)
  165. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
  166. message(STATUS "Enabling AVX in tests/examples")
  167. endif()
  168. option(EIGEN_TEST_FMA "Enable/Disable FMA in tests/examples" OFF)
  169. if(EIGEN_TEST_FMA AND NOT EIGEN_TEST_NEON)
  170. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma")
  171. message(STATUS "Enabling FMA in tests/examples")
  172. endif()
  173. option(EIGEN_TEST_ALTIVEC "Enable/Disable AltiVec in tests/examples" OFF)
  174. if(EIGEN_TEST_ALTIVEC)
  175. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec -mabi=altivec")
  176. message(STATUS "Enabling AltiVec in tests/examples")
  177. endif()
  178. option(EIGEN_TEST_VSX "Enable/Disable VSX in tests/examples" OFF)
  179. if(EIGEN_TEST_VSX)
  180. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mvsx")
  181. message(STATUS "Enabling VSX in tests/examples")
  182. endif()
  183. option(EIGEN_TEST_NEON "Enable/Disable Neon in tests/examples" OFF)
  184. if(EIGEN_TEST_NEON)
  185. if(EIGEN_TEST_FMA)
  186. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon-vfpv4")
  187. else()
  188. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon")
  189. endif()
  190. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=softfp")
  191. message(STATUS "Enabling NEON in tests/examples")
  192. endif()
  193. option(EIGEN_TEST_NEON64 "Enable/Disable Neon in tests/examples" OFF)
  194. if(EIGEN_TEST_NEON64)
  195. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  196. message(STATUS "Enabling NEON in tests/examples")
  197. endif()
  198. check_cxx_compiler_flag("-fopenmp" COMPILER_SUPPORT_OPENMP)
  199. if(COMPILER_SUPPORT_OPENMP)
  200. option(EIGEN_TEST_OPENMP "Enable/Disable OpenMP in tests/examples" OFF)
  201. if(EIGEN_TEST_OPENMP)
  202. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
  203. message(STATUS "Enabling OpenMP in tests/examples")
  204. endif()
  205. endif()
  206. else(NOT MSVC)
  207. # C4127 - conditional expression is constant
  208. # C4714 - marked as __forceinline not inlined (I failed to deactivate it selectively)
  209. # We can disable this warning in the unit tests since it is clear that it occurs
  210. # because we are oftentimes returning objects that have a destructor or may
  211. # throw exceptions - in particular in the unit tests we are throwing extra many
  212. # exceptions to cover indexing errors.
  213. # C4505 - unreferenced local function has been removed (impossible to deactive selectively)
  214. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /wd4127 /wd4505 /wd4714")
  215. # replace all /Wx by /W4
  216. string(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  217. check_cxx_compiler_flag("/openmp" COMPILER_SUPPORT_OPENMP)
  218. if(COMPILER_SUPPORT_OPENMP)
  219. option(EIGEN_TEST_OPENMP "Enable/Disable OpenMP in tests/examples" OFF)
  220. if(EIGEN_TEST_OPENMP)
  221. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp")
  222. message(STATUS "Enabling OpenMP in tests/examples")
  223. endif()
  224. endif()
  225. option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF)
  226. if(EIGEN_TEST_SSE2)
  227. if(NOT CMAKE_CL_64)
  228. # arch is not supported on 64 bit systems, SSE is enabled automatically.
  229. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
  230. endif(NOT CMAKE_CL_64)
  231. message(STATUS "Enabling SSE2 in tests/examples")
  232. endif(EIGEN_TEST_SSE2)
  233. endif(NOT MSVC)
  234. option(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION "Disable explicit vectorization in tests/examples" OFF)
  235. option(EIGEN_TEST_X87 "Force using X87 instructions. Implies no vectorization." OFF)
  236. option(EIGEN_TEST_32BIT "Force generating 32bit code." OFF)
  237. if(EIGEN_TEST_X87)
  238. set(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION ON)
  239. if(CMAKE_COMPILER_IS_GNUCXX)
  240. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=387")
  241. message(STATUS "Forcing use of x87 instructions in tests/examples")
  242. else()
  243. message(STATUS "EIGEN_TEST_X87 ignored on your compiler")
  244. endif()
  245. endif()
  246. if(EIGEN_TEST_32BIT)
  247. if(CMAKE_COMPILER_IS_GNUCXX)
  248. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
  249. message(STATUS "Forcing generation of 32-bit code in tests/examples")
  250. else()
  251. message(STATUS "EIGEN_TEST_32BIT ignored on your compiler")
  252. endif()
  253. endif()
  254. if(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)
  255. add_definitions(-DEIGEN_DONT_VECTORIZE=1)
  256. message(STATUS "Disabling vectorization in tests/examples")
  257. endif()
  258. option(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT "Disable explicit alignment (hence vectorization) in tests/examples" OFF)
  259. if(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT)
  260. add_definitions(-DEIGEN_DONT_ALIGN=1)
  261. message(STATUS "Disabling alignment in tests/examples")
  262. endif()
  263. option(EIGEN_TEST_NO_EXCEPTIONS "Disables C++ exceptions" OFF)
  264. if(EIGEN_TEST_NO_EXCEPTIONS)
  265. ei_add_cxx_compiler_flag("-fno-exceptions")
  266. message(STATUS "Disabling exceptions in tests/examples")
  267. endif()
  268. option(EIGEN_TEST_CXX11 "Enable testing with C++11 and C++11 features (e.g. Tensor module)." OFF)
  269. include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
  270. # Backward compatibility support for EIGEN_INCLUDE_INSTALL_DIR
  271. if(EIGEN_INCLUDE_INSTALL_DIR)
  272. message(WARNING "EIGEN_INCLUDE_INSTALL_DIR is deprecated. Use INCLUDE_INSTALL_DIR instead.")
  273. endif()
  274. if(EIGEN_INCLUDE_INSTALL_DIR AND NOT INCLUDE_INSTALL_DIR)
  275. set(INCLUDE_INSTALL_DIR ${EIGEN_INCLUDE_INSTALL_DIR}
  276. CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed")
  277. else()
  278. set(INCLUDE_INSTALL_DIR
  279. "${CMAKE_INSTALL_INCLUDEDIR}/eigen3"
  280. CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed"
  281. )
  282. endif()
  283. set(CMAKEPACKAGE_INSTALL_DIR
  284. "${CMAKE_INSTALL_LIBDIR}/cmake/eigen3"
  285. CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen3Config.cmake is installed"
  286. )
  287. set(PKGCONFIG_INSTALL_DIR
  288. "${CMAKE_INSTALL_DATADIR}/pkgconfig"
  289. CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where eigen3.pc is installed"
  290. )
  291. # similar to set_target_properties but append the property instead of overwriting it
  292. macro(ei_add_target_property target prop value)
  293. get_target_property(previous ${target} ${prop})
  294. # if the property wasn't previously set, ${previous} is now "previous-NOTFOUND" which cmake allows catching with plain if()
  295. if(NOT previous)
  296. set(previous "")
  297. endif(NOT previous)
  298. set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}")
  299. endmacro(ei_add_target_property)
  300. install(FILES
  301. signature_of_eigen3_matrix_library
  302. DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel
  303. )
  304. if(EIGEN_BUILD_PKGCONFIG)
  305. configure_file(eigen3.pc.in eigen3.pc @ONLY)
  306. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc
  307. DESTINATION ${PKGCONFIG_INSTALL_DIR}
  308. )
  309. endif(EIGEN_BUILD_PKGCONFIG)
  310. add_subdirectory(Eigen)
  311. add_subdirectory(doc EXCLUDE_FROM_ALL)
  312. include(EigenConfigureTesting)
  313. # fixme, not sure this line is still needed:
  314. enable_testing() # must be called from the root CMakeLists, see man page
  315. if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
  316. add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest
  317. else()
  318. add_subdirectory(test EXCLUDE_FROM_ALL)
  319. endif()
  320. if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
  321. add_subdirectory(blas)
  322. add_subdirectory(lapack)
  323. else()
  324. add_subdirectory(blas EXCLUDE_FROM_ALL)
  325. add_subdirectory(lapack EXCLUDE_FROM_ALL)
  326. endif()
  327. add_subdirectory(unsupported)
  328. add_subdirectory(demos EXCLUDE_FROM_ALL)
  329. # must be after test and unsupported, for configuring buildtests.in
  330. add_subdirectory(scripts EXCLUDE_FROM_ALL)
  331. # TODO: consider also replacing EIGEN_BUILD_BTL by a custom target "make btl"?
  332. if(EIGEN_BUILD_BTL)
  333. add_subdirectory(bench/btl EXCLUDE_FROM_ALL)
  334. endif(EIGEN_BUILD_BTL)
  335. if(NOT WIN32)
  336. add_subdirectory(bench/spbench EXCLUDE_FROM_ALL)
  337. endif(NOT WIN32)
  338. configure_file(scripts/cdashtesting.cmake.in cdashtesting.cmake @ONLY)
  339. ei_testing_print_summary()
  340. message(STATUS "")
  341. message(STATUS "Configured Eigen ${EIGEN_VERSION_NUMBER}")
  342. message(STATUS "")
  343. option(EIGEN_FAILTEST "Enable failtests." OFF)
  344. if(EIGEN_FAILTEST)
  345. add_subdirectory(failtest)
  346. endif()
  347. string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower)
  348. if(cmake_generator_tolower MATCHES "makefile")
  349. message(STATUS "Some things you can do now:")
  350. message(STATUS "--------------+--------------------------------------------------------------")
  351. message(STATUS "Command | Description")
  352. message(STATUS "--------------+--------------------------------------------------------------")
  353. message(STATUS "make install | Install Eigen. Headers will be installed to:")
  354. message(STATUS " | <CMAKE_INSTALL_PREFIX>/<INCLUDE_INSTALL_DIR>")
  355. message(STATUS " | Using the following values:")
  356. message(STATUS " | CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
  357. message(STATUS " | INCLUDE_INSTALL_DIR: ${INCLUDE_INSTALL_DIR}")
  358. message(STATUS " | Change the install location of Eigen headers using:")
  359. message(STATUS " | cmake . -DCMAKE_INSTALL_PREFIX=yourprefix")
  360. message(STATUS " | Or:")
  361. message(STATUS " | cmake . -DINCLUDE_INSTALL_DIR=yourdir")
  362. message(STATUS "make doc | Generate the API documentation, requires Doxygen & LaTeX")
  363. message(STATUS "make check | Build and run the unit-tests. Read this page:")
  364. message(STATUS " | http://eigen.tuxfamily.org/index.php?title=Tests")
  365. message(STATUS "make blas | Build BLAS library (not the same thing as Eigen)")
  366. message(STATUS "make uninstall| Removes files installed by make install")
  367. message(STATUS "--------------+--------------------------------------------------------------")
  368. else()
  369. message(STATUS "To build/run the unit tests, read this page:")
  370. message(STATUS " http://eigen.tuxfamily.org/index.php?title=Tests")
  371. endif()
  372. message(STATUS "")
  373. set ( EIGEN_VERSION_STRING ${EIGEN_VERSION_NUMBER} )
  374. set ( EIGEN_VERSION_MAJOR ${EIGEN_WORLD_VERSION} )
  375. set ( EIGEN_VERSION_MINOR ${EIGEN_MAJOR_VERSION} )
  376. set ( EIGEN_VERSION_PATCH ${EIGEN_MINOR_VERSION} )
  377. set ( EIGEN_DEFINITIONS "")
  378. set ( EIGEN_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" )
  379. set ( EIGEN_INCLUDE_DIRS ${EIGEN_INCLUDE_DIR} )
  380. set ( EIGEN_ROOT_DIR ${CMAKE_INSTALL_PREFIX} )
  381. configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3Config.cmake.in
  382. ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake
  383. @ONLY ESCAPE_QUOTES
  384. )
  385. install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UseEigen3.cmake
  386. ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake
  387. DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}
  388. )
  389. # Add uninstall target
  390. add_custom_target ( uninstall
  391. COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/EigenUninstall.cmake)