2

I'm using VS2012+cmake2.8.12. My problem is that CMake failed to generate the correct path to my external project. For example:

Project("{...}") = "external", "external.vcxproj", "..."  

whereas 'external.vcxproj' should be something like ..\path\to\external.vcxproj

Here is how I use ExternalProject_Add command:

ExternalProject_Add(external SOURCE_DIR ${CMAKE_SOURCE_DIR}/../../int/external
                    CMAKE_ARGS ..
                    BINARY_DIR ${CMAKE_SOURCE_DIR}/../../int/external/build)

Any help is highly appreciated!

RAM
  • 2,257
  • 2
  • 19
  • 41
user11869
  • 1,083
  • 2
  • 14
  • 29

1 Answers1

2

Building Visual Studio projects with ExternalProject_Add works slightly different. The whole ExternalProject module is platform-independent and unaware of the peculiarities of Visual Studio's build system. Thus just adding a VS project will not work, since ExternalProject does not know how to build it. Instead you have to specify the full command line for building the project. Something like:

ExternalProject_Add(external_test
    SOURCE_DIR ${PROJECT_SOURCE_DIR}
    CONFIGURE_COMMAND ""
    BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} ${PROJECT_SOURCE_DIR}/path/to/external.sln /build Release /project optional_project_within_solution
    INSTALL_COMMAND "")

As you can see, it's quite a mess. If you just want to include an existing VS project with your CMake generated solution, consider using include_external_msproject instead.

ComicSansMS
  • 51,484
  • 14
  • 155
  • 166