Commit Graph

27 Commits

Author SHA1 Message Date
Sergiu Deitsch 93511bfdc9 Fix SuiteSparse path and version reporting
If SuiteSparse is found, an unhelpful message "Found SuiteSparse: TRUE
..." is printed. Instead, report the found include directory and version
information which was previously not shown due to unset
SuiteSparse_FOUND variable.

Change-Id: Ib43fb99934f34e6007110007d2cd4a8fbd841aa2
2022-03-14 20:27:24 +01:00
Brent Yi d3612c12c0 Set CMP0057 policy for IN_LIST operator in FindSuiteSparse.cmake
A recent change introduced some uses of `IN_LIST` in
FindSuiteSparse.cmake, but this is only introduced in cmake 3.3 and
breaks downstream projects that set cmake_minimum_required() to anything
lower.

This commit locally sets CMP0057, which enables the `IN_LIST` operator
and fixes the build for these projects.

Primarily motivated by colmap, which sets cmake_minimum_required(3.0)
and is currently broken: https://github.com/colmap/colmap/issues/1451

Change-Id: I9580c86f56248611326a932b8650b9048fb0ff14
2022-03-09 02:35:00 -08:00
Sergiu Deitsch 4bc100c13d Do not define unusable import targets
In the case, necessary properties of import targets cannot be set (i.e.,
either because the include directory or the library was found), do not
define import target to begin with.

Change-Id: Id216cd692a8ec240a20f65b174f196ddaa306c2b
2022-03-09 09:52:44 +00:00
Sergiu Deitsch 817f5a0688 Switch to imported SuiteSparse, CXSparse, and METIS targets
These changes allow the use of a SuiteSparse CMake package from
https://github.com/sergiud/SuiteSparse that allows native compilation of
SuiteSparse using CMake on a variety of platforms Packages generated
using official SuiteSparse makefiles can still be used without
modifications. The find module remains agnostic to specific CMake
package implementation.

CMake packages have the advantage that they are self-contained and
relocatable. The latter is particularly useful in cross-compilation
scenarios.

Fixes #728

Change-Id: I089d5c6f87c05b1530a5ab9a36dff2fcbe82d13d
2022-03-03 21:26:45 +01:00
Alex Stewart 4e69a475cd Fix potential for mismatched release/debug TBB libraries
- Protect against the case when the user has multiple installs of TBB
  in their search paths and the first install does not contain debug
  libraries.  In this case it is possible to get mismatched versions
  of TBB inserted into TBB_LIBRARIES.
- Also suppresses warning about use of TBB_ROOT on modern versions of
  CMake due to CMP0074.

Change-Id: I2eaafdde4a028cbf6c500c63771973d85bc4723d
2020-09-03 19:55:58 +01:00
Alex Stewart ee7e2cb3c8 Set Homebrew paths via HINTS not CMAKE_PREFIX_PATH
- Adding the Homebrew install prefix to CMAKE_PREFIX_PATH, irrespective
  of whether it is a standard location (e.g. /usr/local) overrides any
  user-specified HINTS locations according to the search order of
  CMake's find_xxx() functions.
- Now we append the relevant include/lib directory to its respective
  HINTS directory variable (to the back to avoid overriding any user
  specified values).  This achieves the same effect, but only after
  searching any user specified values.
- Also adds Homebrew install prefix to find_package() calls for
  dependencies optionally exported with CMake after the possible user
  specified <DEPENDENCY_NAME>_DIR prefix.
- Raised as issue #431

Change-Id: I47030f0f4fd9b96665fac57279be2285d9700b9a
2019-03-07 22:12:44 +00:00
Alex Stewart 16f9b34c3b Remove Intel TBB threading support.
- In light of the C++11 threads threading option this is no longer
  necessary for cross-platform threading support and did not offer a
  noticeable performance gain over either the C++11 threads
  implementation or OpenMP.

Change-Id: Icb588d520888c19a1775171795b55bcaffb3d256
2018-07-03 18:05:36 +00:00
Alex Stewart 488d401ac3 Cleanup import of TBB in CMake.
- Update FindSuiteSparse to use FindTBB.cmake to find TBB.
- Fix logic handling of TBB=ON if TBB is not found to continue with
  build after disabling TBB rather than throwing a fatal error.
- Use TBB_LIBRARIES instead of TBB_tbb_LIBRARY as a Ceres dependency,
  the former also includes the TBB malloc library.
- Add warning message about GPL licensing if TBB version < 2017.
- Add ‘TBB’ & ‘Mulithreading’ component options to find_package(Ceres),
  where ‘Mulithreading’ is equivalent to ‘TBB’ || ‘OpenMP’.

Change-Id: Ifc7f1d01b050ba6e2097ad1913b178805df4769a
2017-12-11 10:15:32 +00:00
Alex Stewart d8f40912f0 Hide optional SuiteSparse vars in CMake GUI by default.
Change-Id: I7d7a82d1cbb8a6689bb383e4de2b9415ab7a3a81
2017-08-13 19:16:46 +01:00
Alex Stewart ffe7cc3eca Always hide TBB_LIBRARY in CMake GUI by default.
Change-Id: I4e5c0985144b48c977ebab539634f66741922502
2017-08-13 18:59:31 +01:00
Arkady Shapkin a1ff7f720f Support suitesparse path suffix on Windows for SuiteSparse and CXSparse
Change-Id: Iaf9b75dc1cb7da5d305ee3fac9a8c28b3d0a2346
2017-07-07 08:44:46 +00:00
Sameer Agarwal 60811dffe1 Fix a bug introduced in fa39fae0b7
The FindSuiteSparse.cmake refactor had a typo where CCOLAMD
and COLAMD were conflated.

Thanks to @jasjuang for reporting this issue and finding the exact
commit where this bug was introduced.

Change-Id: If8ef6624df3b8b2fd7f0861eafc4700173401435
2017-07-02 00:09:21 -07:00
Alex Stewart fa39fae0b7 Pass user-specified search hints as HINTS not PATHS.
- As reported as Issue #285, previously we passed user-specified hint
  locations as PATHS to find_path/library which means that they are
  searched after system locations. Now we pass them as HINTS, which are
  searched before system locations.
- Also clean-up FindSuiteSparse to replace repeated code for finding
  each component with a common macro.

Change-Id: I20a1f905d929a23037b1d0b7fb7ffe817abaa3e3
2017-06-05 08:35:02 +00:00
Alex Stewart 8a2da98ac2 Clear XXX_FOUND in Find<XXX>.cmake prior to searching.
- This protects against a client project which invokes
  find_package(Ceres) after having called find_package(Foo) with their
  own version of FindFoo.cmake which conflicts with Ceres’ exported
  version and defines FOO_FOUND, but not the other variables Ceres’
  FindFoo.cmake is expecting which can break the detection logic.

Change-Id: I9fe7bfa8a34bb58b09ffe34446da973912cf5587
2016-12-01 18:20:11 +00:00
Alex Stewart 562a72ea2b Fix missing early return() in xxx_not_found() dependency macros.
- This could result in potentially confusing output if dependencies
  were found with the QUIET option: "XXX not found due to ...", followed
  by "found <part of> XXX".
- If find_package() was called with REQUIRED, then a FATAL_ERROR was
  triggered in the xxx_not_found() macros, resulting in early
  termination.

Change-Id: Ibf59afd10067b9debd1a5e15f735a41b61bed52e
2016-02-06 15:58:10 +00:00
Alex Stewart cc8d47aabb Update all CMake to lowercase function name style.
- Updated to new CMake style where function names are all lowercase,
  this will be backwards compatible as CMake function names are
  case insensitive.
- Updated using Emacs' M-x unscreamify-cmake-buffer.

Change-Id: If7219816f560270e59212813aeb021353a64a0e2
2015-08-09 15:18:42 +01:00
Alex Stewart 58ee9f7d9b Handle possible presence of library prefixes in MSVC.
- On MSVC, a Ceres dependency such as glog, may be named glog.lib, or
  libglog.lib.  By default, CMake assumes no prefix for libraries on
  MSVC when using find_library(), thus find_library(glog) would fail
  if glog was named libglog.lib.
- This patch caches & updates CMAKE_FIND_LIBRARY_PREFIXES in all of
  Ceres' find_package scripts to include lib & "" (no prefix) on MSVC
  and then returns CMAKE_FIND_LIBRARY_PREFIXES to its original state
  before returning.

Change-Id: Ic82799e3b786cfb7228a51183bc189578b072bbe
2015-03-31 00:47:44 +00:00
Keir Mierle 7492b0d8de Update copyright headers with new year and URL
Since Ceres is moving to using GitHub for issues, and the Google
Code URL in the current copyright header will soon become invalid,
update all the headers.

Change-Id: I1fce70375d1bcf098591f07b4d8f01a5c1e0789c
2015-03-18 05:43:23 +00:00
Alex Stewart f4f753ab68 Fix empty Cache HELPSTRING parsing error on OS X 10.10 Yosemite.
- Without quotations, on Yosemite, CMake will fail on first configure,
  but will then work fine subsequently.  This is because if the
  HELPSTRING property is empty, without "" quotes, it is removed from
  the arguments list for set().

Change-Id: Ia60444695e9770b947f145a54e949c9eeae67fbb
2014-10-24 10:38:13 +01:00
Andreas Franek 6cb82b609a METIS_FOUND is never set.
Changed the commit to fit the setting of the other *_FOUND definitions.

Change-Id: I3f0d11a9a65a0decd1a6a6b28a4a4823eb74c9c3
2014-02-20 17:52:51 +01:00
Alex Stewart b5be6b9c06 Cleaning up messages output when SuiteSparse is not found.
- Automatically generated failure message now provides more
  information as to which sub-modules are missing.

Change-Id: I6eed94af49263540b8f87917b75c41b8f49658a0
2013-11-05 21:12:48 +00:00
Alex Stewart 69bd65ff43 Downgrading warning messages when optional deps are not found.
- Now when find_package() is called for a dependency without the
  REQUIRED or QUIET qualifiers, we emit no priority (above STATUS, but
  below WARNING) messages and continue.

Change-Id: I8cdeda7a8f6c91d45fb7f24fb366244c6c9b66e1
2013-11-04 23:01:14 +00:00
Alex Stewart b0a8731fcd Removing duplicate SuiteSparse found message.
- Also flipping ordering of variables in
  find_package_handle_standard_args() so that the automatically
  generated message prints the include directories, not TRUE.

Change-Id: I2bf62eacd5c96f27152e9542b9a74651243a584e
2013-11-04 20:32:40 +00:00
Alex Stewart 6fed9fe0de Fix FindPackage scripts to emit warnings, not errors if not found.
- Previously we used message priority: SEND_ERROR when a package was
  not found and find_package() was called without QUIET or REQUIRED,
  which emits an error message, and prevents generation, but continues
  configuration.
- The fact SEND_ERROR induces an error message was confusing for users
  as it implies that something bad has happened and they cannot
  continue, when in fact we were disabling the option in question
  and were thus able to continue, all they had to do was re-configure.

- This commit also reorders the search lists for includes/libraries
  so that we always search user installed locations (e.g. /usr/local)
  before system installed locations.  Thus we will now always prefer
  a user install to a system install if both are available, which is
  likely to be the users desired intention.

Change-Id: Ide84919f27d3373f31282f70c685720cd77a6723
2013-11-04 19:08:17 +00:00
Alex Stewart 78cc2c4719 Cleaning up exported CeresConfig.cmake.
- Adding FindPackage scripts for all of Ceres dependencies.
- Moving depend.cmake contents to CeresConfig.cmake and cleaning up
  search for Ceres & required dependencies, no longer push Ceres
  options into client.
- Fixing uninstall to remove ceres include root directory.
- Fixing main CMakeLists to install miniglog header if enabled.
- Making miniglog library shared/static with Ceres library.

Change-Id: If926bebd11720230c5136597ccba672394ed9777
2013-10-17 19:13:08 +00:00
Alex Stewart 003a1624f4 Fixing issue with CMake >= 2.8.10.2 FindPackageHandleStandardArgs.
- Prior to CMake 2.8.10.2 FindPackageHandleStandardArgs was safe if
  passed <LIBRARY>_FOUND as a variable to validate, this is no longer
  true for newer CMake releases.
- Also adding missing SUITESPARSEQR_FOUND requirement for
  SUITESPARSE_FOUND.

Change-Id: I0fdde56585fc736bdfbf433901ad17ee9f1cc216
2013-10-09 18:39:43 +00:00
Alex Stewart 0b07d3e9f9 Making all config options in CMake & SuiteSparse cleanup.
- Also marking all library and include directories found via
  find_library/path advanced (not directly visible in CMake GUI unless
  toggled to show advanced options).
- Updating documentation to reflect SuiteSparse requirements on Ubuntu
  and ability to control build options in CMake GUI.
- Splitting out all SuiteSparse related find_XX directives into a
  FindSuiteSparse script.

Change-Id: I0d69e02392ec547a7c365ba3e06f2ebc61cacf16
2013-10-07 19:50:24 +01:00