[Cmake] INCLUDE_DIRECTORIES and empty strings

Wheeler, Fred (Research) wheeler at crd.ge.com
Mon Jun 24 15:33:31 EDT 2002


With CMake 1.4 beta making NMake makefiles in win32, the following

  SET( OPENGL_INCLUDE_PATH "" )
  INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_PATH})

leads to compile commands that look like this

  cl ... -IC:\foo -I -IC:\bar

the middle -I command is empty because OPENGL_INCLUDE_PATH is "" (bug?).  The is causing problems
with the revamped (on a branch) CMake files in VXL because the new FindXXX.cmake Modules set
XXX_LIBRARIES and XXX_INCLUDE_PATH if XXX is available, and then the local CMakeLists.txt file use
XXX by calling TARGET_LINK_LIBRARIES and INCLUDE_DIRECTORIES with XXX_LIBRARIES and XXX_INCLUDE_PATH
as the respective arguments.

OpenGL is a special case in win32 as OPENGL_LIBRARIES will have a value ("GL GLU"), but there is no
special include path needed.

Bottom line: it would be nice if INCLUDE_DIRECTORIES did nothing when passed an empty string.

Fred Wheeler



More information about the CMake mailing list