- If a CMake-ified version of gflags is not detected, then
gflags_LIBRARIES is not set and the TARGET condition within a
multiconditional if() statement prevents configuration.
Change-Id: Ia92e97523d7a1478ab36539726b9540d7cfee5d0
- 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
- gflags <= 2.1.2 has a bug in its exported gflags-config.cmake:
https://github.com/gflags/gflags/issues/110 whereby it sets
gflags_LIBRARIES to a non-existent 'gflags' target.
- This causes linker errors if gflags is installed in a non-standard
location (as otherwise CMake resolves gflags to -lgflags which
links if gflags is installed somewhere on the current path).
- We now check for this case, and search for the correct gflags imported
target and update gflags_LIBRARIES to reference it if found, otherwise
proceed on to the original manual search to try to find gflags.
Change-Id: Iceccc3ee53c7c2010e41cc45255f966e7b13d526
- Split out gflags namespace detection methods:
check_cxx_source_compiles() & regex, into separate functions.
- Use installed/exported gflags CMake configuration (present for
versions >= 2.1) if available, unless user expresses a preference not
to, or specifies search directories, in which case fall back to manual
search for components.
-- Prefer installed gflags CMake configurations over exported gflags
build directories on all OSs.
- Remove custom version of check_cxx_source_compiles() that attempted
to force the build type of the test project. This only worked for
NMake on Windows, not MSVC as msbuild ignored our attempts to force
the build type. Now we always use the regex method on Windows if
we cannot find an installed gflags CMake configuration which works
even on MSVC by bypassing msbuild.
- Add default search paths for gflags on Windows.
Change-Id: I083b267d97a7a5838a1314f3d41a61ae48d5a2d7
- 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
- Add missing gflags threading dependency.
- Also add optional gflags Shlwapi dependency on Windows.
- Add check_cxx_source_compiles() with CMAKE_BUILD_TYPE to fix
namespace test builds on Windows with NMake generators.
- Add namespace regex on gflags.h when check_cxx_source_compiles()
fails on Windows using Visual Studio generator.
Change-Id: I6570c566e5a29c665d621a54935c16d16bac7117
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
- At version 2.1, gflags changed from using the google namespace, to
using gflags by default. However, it can be configured at build time
to be something else (which would be google for legacy compatibility
unless you were evil).
- Ceres previously assumed that gflags was in the google namespace.
- Now, FindGFlags.cmake extracts the namespace when gflags.h is found
and saves it in GFLAGS_NAMESPACE.
- When building the tests and examples that require gflags,
CERES_GFLAGS_NAMESPACE is defined to be the detected namespace, and
all tests/examples now use CERES_GFLAGS_NAMESPACE:: instead of
google:: when calling gflags functions.
Change-Id: Ia333df7a7e2f08ba9f26bbd339c3a785b88f04c4
- The HINTS variables for gflags were incorrectly used as
GFLAGS_[INCLUDE/LIBRARY]_HINTS when they should have been
GFLAGS_[INCLUDE/LIBRARY]_DIR_HINTS as per the docs.
- Also removing a completed TODO in the main CMakeLists.
- Updating method of extracting current directory in CeresConfig.cmake
to avoid use of CMAKE_CURRENT_LIST_DIR, which was not present in
CMake =< v2.8.3.
Change-Id: I42ae696e3b785febe48688d912f0f343e8947cb0
- 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
- 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
- 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
- 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