[CMake] Supressing Make, but not Generators

Smith Jack (Ext. - UGIS - UniCredit Group) jack.smith.extern at unicreditgroup.de
Wed Mar 3 05:03:49 EST 2010



> -----Original Message-----
> From: Eric Noulard [mailto:eric.noulard at gmail.com]
> Sent: Wednesday, March 03, 2010 10:51 AM
> To: Smith Jack (Ext. - UGIS - UniCredit Group)
> Cc: cmake at cmake.org
> Subject: Re: [CMake] Supressing Make, but not Generators
>
> 2010/3/3 Smith Jack (Ext. - UGIS - UniCredit Group)
> <jack.smith.extern at unicreditgroup.de>:
> >
> >
> >> -----Original Message-----
> >> From: cmake-bounces at cmake.org
> >> [mailto:cmake-bounces at cmake.org] On Behalf Of J Decker
> >> Sent: Wednesday, March 03, 2010 9:34 AM
> >> To: cmake at cmake.org
> >> Subject: Re: [CMake] Supressing Make, but not Generators
> >>
> >> You can test for platform flags..
> >>
> >> if( win32 )
> >> add_subdirectory( these_compile )
> >> #...
> >> endif( win32 )
> >>
> >> ....
> >>
> >> or add specific options that can be checked
> >>
> >> http://www.cmake.org/Wiki/CMake_Useful_Variables
> >
> > Thanks , but that doesn't solve the problem.  If I
> conditionally include a sub directory, then the generator
> will not be run against the project in that subdirectory.
> >
> > I want to generator (VisualStudio/Eclipse/whatever) to
> always run so that I may always see the entire project
> hierarchy within my development environment, but the
> generated makefile to perform a platform test to see if it
> should build the target.
> >
> > Is this possible.
>
> I don't think it is possible.
>
> You want to export usual "CMake-time" decision to
> "Build-time", the specific platform check are not meant to be
> exported at build time.
>
> I'm not even sure it would be wise to try to do it (in the
> general case) because with add_custom_command/target you may
> be trying to execute platform specific executable on the


> wrong platform.
>
> I think the "EXCLUDE_FROM_ALL" proposed by Hendrik and
> explained by Michael is the best way to go.
>
> What to compile will NOT be decided at Build time but you'll
> be able to browse the code.
>
> The CMake design is something like "one build tree for one platform"
> what you ask for is more like "dynamic build tree for several
> platform".
>
> As a side note I did cross some time ago a build system based
> on hand-written re-entrant GNU makefile which supported the
> scheme you described.
> I was nice but not that easy to maintain compared to a CMake
> build system.
>
> All of this is off course my own point of view :-)
>
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel
> libre » - http://www.april.org
>


Thanks for the response.  I think Michael's solution fits my needs (although I haven't yet tested it.)

Jack


More information about the CMake mailing list