[CMake] Advice for CMake_import_build_settings
Mathieu Malaterre
mathieu.malaterre at gmail.com
Sat May 24 10:31:45 EDT 2008
On Fri, May 23, 2008 at 5:46 PM, Brad King <brad.king at kitware.com> wrote:
> Blezek, Daniel J., Ph.D. wrote:
>>
>> I'd like to build and install Insight (though the toolkit is not
>> important) using GCC. Then I want to build applications using GCC, the
>> Intel compiler, and IBM's XLC compiler. All should be able to use the
>> GCC-build libraries. However, CMAKE prohibits this with the
>> CMake_import_build_settings command, which forces the project to change it's
>> compiler, and consequently wreaking havok on my CMakeCache. This is really
>> frustrating. I have to build and install 3 versions of Insight, when only
>> one is really needed.
>>
>> My question: Is this behavior strictly necessary? I can see it may have
>> utility on Windows, but makes less sense in Linux, especially in our case.
>> Is it possible to augment or override this command, or do I pick it out of
>> our installed libraries?
>
> It used to be necessary to keep inexperienced users from mixing ABIs.
> However, modern C++ compilers (within the last 5 years or so) have a more
> standard ABI so it's not a problem. In CMake 2.6 you can override the
> behavior by using
>
> set(CMAKE_OVERRIDE_COMPILER_MISMATCH 1)
>
> before including ITK. Alternatively for any CMake version you can write
>
> find_package(ITK REQUIRED)
> set(ITK_BUILD_SETTINGS_FILE)
> include(${ITK_USE_FILE})
>
> The middle line tells the UseITK.cmake file to skip the build settings step.
>
> In the future I plan to get rid of this stuff from ITK and VTK in favor of
> something more reliable.
+1
--
Mathieu
More information about the CMake
mailing list