[CMake] A configure script solution

Mike Jackson mike.jackson at imts.us
Tue Jun 24 12:55:57 EDT 2008


One way to get the "optional" packages compiled is to add something  
like the following to your cmakelists.txt file:


OPTION(BUILD_FOO "Option to build Foo subproject" ON)
OPTION(BUILD_BAR "option to build Bar subproject" OFF)

IF (BUILD_FOO)
ADD_SUBDIRECTORY( ${Foo_Dir} )
ENDIF (BUILD_FOO)

IF (BUILD_BAR)
ADD_SUBDIRECTORY(${Bar_DIR} )
ENDIF (BUILD_BAR)

Then, if you _really_ wanted to, you could have a simple bash script  
which lets someone set these values by taking arguments then passing  
those to cmake using the -Dlibdir="your/path/to/lib" syntax. Just  
running ccmake is probably quicker although can not be "automated".

Just my 2 cents..

-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Jun 24, 2008, at 12:27 PM, J wrote:

> Greetings all!
>
> I've been sold on cmake. From what I gather, it's hands down better  
> than
> automake and family. However, I do have a problem with not having a
> configure script.
>
> A couple of the main benefits of having a configure script are letting
> the user/package maintainer choose portions of a project to compile or
> exclude from compilation, as well as choosing alternate locations for
> libraries/includes/installations, both of which are rather important.
>
> Without a configure script all package maintainers for red hat/fedora,
> debian/ubuntu, etc will have to learn all the ins and outs of cmake  
> and
> spend oodles of time setting variables and passing -D switches to  
> cmake.
>
> So my question to everyone is, is there already a replacement  
> configure
> system/script that mimics or replaces the configure scripts created by
> autotools?
>
> The KDE folks wrote a very simple configure script by hand it seems,
> which replaces rudimentary options such as --libdir and such, which  
> is a
> start but not nearly complete enough to actually replace autoconf's
> configure scripts.
>
> Thanks in advance for any information you can provide.
>
> j
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>




More information about the CMake mailing list