[Cmake] Proper way to embed or nest a separate project into another project?

Andy Cedilnik andy.cedilnik at kitware.com
Fri, 12 Mar 2004 17:32:43 -0500


Hi Eric,

On Fri, 2004-03-12 at 17:29, Eric Wing wrote:
> So in the case of NOT using the SYSTEM Lua, does CMake
> automatically invoke Lua's seperate build system? Does
> this mean that Lua's specific build options become
> visible in the encompassing project's ccmake window? 

No. My example implies that you wrote CMake files for LUA in
Utilities/LUA.

> Also, rather than setting the
> OPTION(USE_SYSTEM_LUA...) default to OFF, is there a
> way to autodectect for Lua first by calling
> FIND_PACKAGE(Lua) on the first ccmake pass, and
> setting the default OPTION(USE_SYSTEM_LUA...) to ON or
> OFF depending on if found. And then later let the user
> change the option (if they choose to) without having
> that autodetect detect scheme reinvoked and fight
> their choice?

You can do that:

FIND_PACKAGE(LUA)
IF(LUA_LIBRARIES and LUA_INCLUDE_PATH)
  MESSAGE("Found system lua")
ELSE(LUA_LIBRARIES and LUA_INCLUDE_PATH)
  MESSAGE("Use my own LUA")
ENDIF(LUA_LIBRARIES and LUA_INCLUDE_PATH)

			Andy