CMake problems

A couple of problems I've ran across so far with an existing cmake project - this is on a Mac.

Despite a default build type being set in our CMakeLists.txt, but it's not picked up by CLion.  Our cmake file has:

 
if ( NOT CMAKE_BUILD_TYPE )
    message ( STATUS "Defaulting CMAKE_BUILD_TYPE to 'Debug'." )
    set ( CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE )
endif()


Yet this stanza (right below the previous) produces an error.  I've had to explicitly set the variable.

 
if ( CMAKE_BUILD_TYPE MATCHES Debug )
    message ( STATUS "Building Debug code." )
elseif ( CMAKE_BUILD_TYPE MATCHES Release )
    message ( STATUS "Building Release code." )
else ()
    message ( FATAL_ERROR "Unrecognized build type." )
endif ()


When building the Debug target, it errors out when trying to link to a bzip2 debug library, there isn't one on the system, and I don't need one either.  Obviously when this is built command line, there is no problem.  Relese build fails build also, although the CMake Cache shows the correct release library was found.  When I updated the cache and saved, forced a clean, still failed.  After much futzing, clean, etc., I removed all the directories except for __default__ in the clion caches, and the build output directory in the __default__.  Made sure the CMakeCache.txt file was correct, refreshed, no-joy.  The build directory makefiles always reference the incorrect library.

find_package( BZip2 REQUIRED )


While not exactly a bug, it would be really really nice to have the non-application targets available, like all, install, test, etc...

Thanks for the great program overall.  It works well enough I can ditch eclipse :-)  Can wait for production release!

Please sign in to leave a comment.