Re: Conditional compilation

Discussion in 'C++' started by Rui Maciel, Dec 26, 2012.

  1. Rui Maciel

    Rui Maciel Guest

    Giuliano Bertoletti wrote:

    > What I'm wondering is if there's some way to set an extern environment
    > variabile and have the compiler read it and use when deciding which
    > portion to compile.


    That's precisely the reason why a bunch of people have developed tools to
    set up automated build scripts. For example, the GNU build system is used
    to generate a header file typically named config.h, which is used to set all
    the relevant platform-specific info needed in the build process.


    Rui Maciel

    [1] http://www.gnu.org/savannah-
    checkouts/gnu/autoconf/manual/autoconf-2.68/html_node/autoheader-
    Invocation.html#autoheader-Invocation
    Rui Maciel, Dec 26, 2012
    #1
    1. Advertising

  2. Rui Maciel

    Ian Collins Guest

    Rui Maciel wrote:
    > Giuliano Bertoletti wrote:
    >
    >> What I'm wondering is if there's some way to set an extern environment
    >> variabile and have the compiler read it and use when deciding which
    >> portion to compile.

    >
    > That's precisely the reason why a bunch of people have developed tools to
    > set up automated build scripts. For example, the GNU build system is used
    > to generate a header file typically named config.h, which is used to set all
    > the relevant platform-specific info needed in the build process.


    I was about to make the same suggestion.

    Autotools also builds makefiles with with the appropriate include paths
    and libraries.

    --
    Ian Collins
    Ian Collins, Dec 26, 2012
    #2
    1. Advertising

  3. Rui Maciel

    Jorgen Grahn Guest

    On Wed, 2012-12-26, Ian Collins wrote:
    > Rui Maciel wrote:
    >> Giuliano Bertoletti wrote:
    >>
    >>> What I'm wondering is if there's some way to set an extern environment
    >>> variabile and have the compiler read it and use when deciding which
    >>> portion to compile.

    >>
    >> That's precisely the reason why a bunch of people have developed tools to
    >> set up automated build scripts. For example, the GNU build system is used
    >> to generate a header file typically named config.h, which is used to set all
    >> the relevant platform-specific info needed in the build process.

    >
    > I was about to make the same suggestion.
    >
    > Autotools also builds makefiles with with the appropriate include paths
    > and libraries.


    The OP was on Windows though, and IIRC solved his problem using some
    Visual Studio thing. I also got the feeling his problems originated in
    oddities specific to that environment.

    (Saying this partly because I'm no friend of Autotools. Undoubtedly
    they are sometimes the right solution, but if you can avoid them IMO
    you should. I have managed to do that so far.)

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
    Jorgen Grahn, Jan 3, 2013
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris P
    Replies:
    0
    Views:
    440
    Chris P
    Oct 28, 2003
  2. avishay

    Conditional compilation in VHDL

    avishay, Aug 1, 2005, in forum: VHDL
    Replies:
    4
    Views:
    3,011
    Andy Peters
    Aug 1, 2005
  3. Praveen
    Replies:
    0
    Views:
    359
    Praveen
    Apr 12, 2005
  4. Praveen Ramesh
    Replies:
    2
    Views:
    2,166
    Steven Cheng[MSFT]
    Apr 13, 2005
  5. Alec S.
    Replies:
    10
    Views:
    10,142
    Alec S.
    Apr 16, 2005
Loading...

Share This Page