0

I am trying to compile a single .cpp file in an otherwise header-only project as the BUILD_COMMAND of my ExternalProject_Add. Ideally, I'd like this build command to compile this one cpp file exactly as it's compiling everything else in the project, with all the associated flags, debugging info and so forth.

I can't seem to find how to make a build command which does this. Any ideas?

experquisite
  • 879
  • 5
  • 14
  • 1
    *ExternalProject* doesn't inherit compile options from the main project, you need to pass these options to the external project through appropriate CMake variables. If you want to compile `.cpp` file with main project's options, just compile it with `add_executable` command. You may make target created by this command dependent from the `ExternalProject` one. So `.cpp` will be garanteed existed when you compile it. – Tsyvarev Aug 06 '16 at 19:15
  • See also: https://stackoverflow.com/questions/12021448/how-can-cmake-arguments-be-forwarded-to-externalproject – thiagowfx Jan 16 '17 at 21:40

0 Answers0