Commit Graph

15 Commits

Author SHA1 Message Date
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 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
Arkady Shapkin a1ff7f720f Support suitesparse path suffix on Windows for SuiteSparse and CXSparse
Change-Id: Iaf9b75dc1cb7da5d305ee3fac9a8c28b3d0a2346
2017-07-07 08:44:46 +00: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 04291898fd Add default Fedora/Debian locations for CXSparse to search paths.
Change-Id: I7361ae3e821eb1f481b28dc9b94f57cb5eb0093f
2017-03-24 14:01:34 +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 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 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 21e7c0fcc7 Adding option for static/shared CRT in MSVC & Windows fixes.
- MSVC users can now choose whether to use the static or shared
  C-Run Time (CRT) libraries explicitly.
- FindPackage() scripts now check that the lowercase libraries match
  the expected library names, as Windows uses CamelCase for some
  library names (other OSs don't).

Change-Id: Icbba5e9bf80181a5437e5009bdda1c12934bc6f3
2013-10-19 14:25:07 +01: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