Hi Hendrik, Could you write a few more lines. I want to understand,... but I don't. ;-)
We only have one copy of Bullet "as a bundle" present on the system. Let's say you just downloaded Bullet. With BULLET_ROOT, we set the root path to that copy and do a find_package(BULLET), it returns with: BULLET_FOUND (only true if everything is found, no, because the libs aren't built) BULLET_INCLUDE_DIR (set if the sources are found, ok, we downloaded the source distribution) BULLET_COLLISION_LIBRARY[_DEBUG] (not defined, we haven't built Bullet (yet)) BULLET_DYNAMICS_LIBRARY[_DEBUG] (not defined, we haven't built Bullet (yet)) BULLET_MATH_LIBRARY[_DEBUG] (not defined, we haven't built Bullet (yet)) >From BULLET_INCLUDE_DIR (which is typically a complete path, something like: C:/development/bullet/src) we can get to the sources to include in our own lib, typically located in C:/development/bullet/src/BulletCollision, C:/development/bullet/src/BulletDynamics, etc. So, if we build with sources, there is no problem at all if the Bullet libs aren't pre built, yet BULLET_FOUND is false. So, it would be nice if "we haven't found everything, but we found this..." would be communicated from find_package(<package>), or... you could specify more clearly what you are looking for, so <package>_FOUND is an exact answer to that specific question. I would guess that this sources/binaries distinction actually is quite common, and it comes in all flavors: - GLEW, only sources. Don't know if there is a findGLEW.cmake. - Boost, only sources (header only) or libs (in rare cases). Boost will return Boost_FOUND true even if the libs are not present (if you didn't specify via COMPONENTS). - Bullet, preferably built from sources in your project, but you can also link to pre built binaries. - OpenGL, only binaries. Well, ok, an include directory but you never actually build OpenGL from source yourself. Again, just a thought, it's not that big of a problem, but it makes your CMake files a bit less elegant: MESSAGE( STATUS "Looking for Bullet..." ) SET(BULLET_ROOT ${DEVELOPMENT_ROOT}/bullet CACHE PATH "Root directory for Bullet") FIND_PACKAGE( BULLET REQUIRED ) IF( BULLET_FOUND ) MESSAGE( STATUS "Bullet found" ) ELSE() IF( RT_SOURCE ) # If the compiled libraries are not found, BULLET_FOUND is false, # this is ok (RT_SOURCE) as long as BULLET_INCLUDE_DIR has been set. IF( BULLET_INCLUDE_DIR ) MESSAGE( STATUS "Bullet include/src directory found" ) ELSE() MESSAGE( STATUS "Bullet include/src directory not found" ) ENDIF() ... Daniel -----Oorspronkelijk bericht----- Van: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] Namens Hendrik Sattler Verzonden: maandag 7 november 2011 12:29 Aan: cmake@cmake.org Onderwerp: Re: [CMake] find_package(), sources only Am 07.11.2011 12:04, schrieb Daniel Dekkers: > Just a thought. Just a thought on your thought. > We are incorporating 3rd party library Bullet in our own library. > This can > be done on two levels (via an option). Either by sources (which is > standard practice with Bullet), or by linking to the built Bullet > libraries directly. > Now find_package(BULLET) (i.e. the findBullet.cmake script) sets > BULLET_FOUND to true only if the include directory *and* the libraries > are found. But if we only use the sources, we don't need the libs and > we ignore the BULLET_FOUND "error" if they don't exist but still use > the path to the include directories. > > Wouldn't it be good if you could extend find_package() with some kind > of "SOURCE-ONLY" communication or do you think that is the > responsibility of the find<package>.cmake writer? If you are using the sources as internal copy of that library, don't you also have the include files as internal copy? In this case, it would be wrong to use the external headers as they might not match your source copy. HS -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake