-I and check_cxx_source_compiles

William A. Hoffman billlist at nycap.rr.com
Thu Apr 20 15:28:39 CEST 2006


At 06:11 AM 4/20/2006, David Faure wrote:
>I'm getting a failure in kdepim's gpgme configure check, because apparently
>check_cxx_source_compiles ignores CMAKE_REQUIRED_INCLUDES?
>
>Indeed http://www.cmake.org/Wiki/CMake_HowToDoPlatformChecks says that it
>honors CMAKE_REQUIRED_FLAGS, but it doesn't mention something like
>CMAKE_REQUIRED_INCLUDES.
>
>But then instead of doing
>set(CMAKE_REQUIRED_INCLUDES ${GPGME_INCLUDES})
>we have to add -I in front of every entry in the include list?
>Can support for CMAKE_REQUIRED_INCLUDES be added instead?
>or am I missing something?
>
>For reference, I have
>CMakeCache.txt:GPGME_INCLUDES:INTERNAL=/Users/dfaure/gpgmedir/include;/Users/dfaure/gpgmedir/include
>which afaik looks correct [the duplicated path is gpgme-config's fault].

You should not have to add -I flags for this.  I just verified and the following works:

include(CheckCXXSourceCompiles)
SET(CMAKE_REQUIRED_INCLUDES /foo/bar;/foo/bill;/foo/3)
CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" RESULT)

$ ../../CMakeRelease-nmake-stage2/bin/cmake --debug-trycompile -G"NMake Makefiles" ..

$ less CMakeFiles/cmTryCompileExec.dir/flags.make
# CMAKE generated file: DO NOT EDIT!
# Generated by "NMake Makefiles" Generator, CMake Version 2.4

CXX_FLAGS =   /DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR   /D_DEBUG /MDd /Zi  /Ob0 /
Od /GZ -I\foo\bar -I\foo\bill -I\foo\3

So, the -I options are being correctly added to the compile line.

-Bill




More information about the Kde-buildsystem mailing list