Friday, February 17, 2017

Can Visual Studio generate configure file?

Leave a Comment

I need to generate a C++ header file that describes the compiler used.

Traditionally we used the CMake command:

configure( ${PROJECT_SOURCE_DIR}/configure.h.in ${PROJECT_BINARY_DIR}/configure.h ) 

which replaces all string sandwiched by "@" (for example @cxx_compiler_name@) with the value of that variable in the cmake build system.

We have been given the requirement to face out CMake, so is there something equivalent in Visual Studio. I'd like to populate the header file with some of the values in the Visual Studio macros.

1 Answers

Answers 1

You can add your configure.h.in file to the project and set a custom build for it that will run perl or sed and replace whatever needed. Don't forget to add configure.h to output files property so Visual Studio can figure out the dependencies and "build" configure.h.in before other sources that use configure.h.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment