[CMake] FIND_PACKAGE generator mismatch?

Brad King brad.king at kitware.com
Mon Jul 3 13:10:34 EDT 2006


Amitha Perera wrote:
> In the VXL project, we use FIND_PACKAGE to allow internal code to use
> the public VXL code. As currently set up, this causes a call to
> CMAKE_IMPORT_BUILD_SETTINGS, which in turn checks that the internal
> project uses the same generator, compiler, and compiler flags as the
> external project.
> 
> In general, I don't see why they *have* to be the same. I understand
> the issues with Windows and needing to make sure certain flags are
> matched. However, I think CMake should not force such a
> match. Similarly, I don't see how the choice of generator should
> affect the build process.
> 
> Are we (VXL folks) using an outdated mechanism for build setting import?

The generators do not really have to be the same, but at the time that 
stuff was first implemented it was far easier to require this than to 
check all the things necessary for binary compatibility.  You could just 
change VXL to not do any automatic build setting import or checking.

The import build settings call is not automatic in FIND_PACKAGE.  The 
UseVXL.cmake file has it hard-coded.  It could be surrounded in an if block:

IF(NOT VXL_NO_IMPORT_BUILD_SETTINGS)
   ...
ENDIF(NOT VXL_NO_IMPORT_BUILD_SETTINGS)

....or just removed completely and replaced by trusting user competence.

-Brad


More information about the CMake mailing list