Alex Ferrier Alex Ferrier - 8 days ago 5
C++ Question

CMake OSX Command line vs GUI Differences

I am trying to configure the project Theia-SfM to compile with XCode on a Mac.

https://github.com/sweeneychris/TheiaSfM

Using CMake 3.5.1 installed via Macports via XCode the package configures and builds fine once the appropriate dependencies are installed, e.g.

mkdir Build
cmake -G XCode ..

-- Generating done
-- Build files have been written to: /Users/alex/src/TheiaSfM/build


If using CMake GUI 3.5.1 downloaded from KitWare, and installed via applications, the same build fails to find ImageMagick. Output ends:

-- Found SuiteSparse 4.2.1
-- Check for ImageMagick
ImageMagick_EXECUTABLE_DIRImageMagick_EXECUTABLE_DIR-NOTFOUND
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find ImageMagick (missing: ImageMagick_convert_EXECUTABLE
ImageMagick_mogrify_EXECUTABLE ImageMagick_convert_EXECUTABLE
ImageMagick_mogrify_EXECUTABLE)


ImageMagick is demonstrably installed (via macports) in /opt/local/bin.

Alexs-MacBook-Pro:TheiaSfM alex$ type -a mogrify
mogrify is /opt/local/bin/mogrify


Is there any obvious reason why identical versions of CMake would fail to find the same package? I'm assuming /opt/local is in my CMake GUI paths search paths, because further up it finds other dependencies there.

-- Found Google Flags: /opt/local/include in namespace: google
-- Check for Google Log
-- Found Google Logging: /opt/local/include
-- Check for Ceres


More generally, is there an active forum for CMake USAGE questions? The whole of CMAKE seems very poorly documented and fails in myriad confusing ways. Simple examples of adding executables and files are useless in understanding these breaks when the majority of failures happen when building large open-source systems with many dependencies.

Additionally, many projects using CMake have low levels of support, e.g. not a project-specific forum for questions and/or are abandoned, and it feels like there should be a public forum for general "how do I get CMAKE to find xxxx type questions."

I wouldn't mind the feeling of spectacularly low productivity (essentially, days of fiddling with command-lines to get a solution that may or may not, compile, link and/or subsequently run in 32 or 64 bit code) if I were new to meta-build systems, but after 15 years of C++ meta-building with Scons, NANT, and others as a game developer, I'm still not quite frankly sure if CMake is an elaborate joke. OpenCV and Bullet are both an excellent examples of projects where it's quicker to just drag the files into your own favorite IDE and start making things compile than to spend days messing with CMake with no obvious support forum.

Answer

Is there any obvious reason why identical versions of CMake would fail to find the same package?

Different ways of installation may result in different settings of default search paths. You may set CMAKE_PREFIX_PATH variable to /opt/local and all your packages there will be found.

I'm assuming /opt/local is in my CMake GUI paths search paths, because further up it finds other dependencies there.

Not quite true.

For search Google Flags, your project (Theia-SfM) uses shipped script FindGFlags.cmake, which explicitely searches the package at /opt/local (see definition and usage of variable GFLAGS_CHECK_INCLUDE_DIRS there).

For searching ImageMagic it uses standard CMake script, which doesn't explicitely search at /opt/local.

Comments