Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define C++ pre-processor code via SEMMacroBuildCLI #27

Open
finetjul opened this issue Apr 1, 2014 · 0 comments
Open

Define C++ pre-processor code via SEMMacroBuildCLI #27

finetjul opened this issue Apr 1, 2014 · 0 comments

Comments

@finetjul
Copy link
Member

finetjul commented Apr 1, 2014

Sometimes it is useful to pass CMake variables into C++ code. The way to do it is to use the CMake configure_file() macro. It takes a *.h.in as input and generate a .h file.
SEMMacroBuildCLI already generate a *CLP.h file. It would be great if we could define pre-processor variables by passing a simple SEMMacroBuildCLI parameter. For example:
in cmake:

SEMMacroBuildCLI( MyCLI PREPROCESSOR MY_CMAKE_VARIABLE ...)

If MY_CMAKE_VARIABLE is True, that would generate in the CLP.h file:
#define MY_CMAKE_VARIABLE
which could then be used in the MyCLI.cxx file:

int main(int argc, char* argv[])
{
  PARSE_ARGS
#ifdefined MY_CMAKE_VARIABLE
  // do something here
#endif
  ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant