<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Dear CMake experts,<br>
I confugure several projects with CMake (seperately). These projects
depend on each other. For Visual Studio I used to include projects
into other projects using INCLUDE_EXTERMAL_MSPROJECT(...), which
worked fine for me as the projects were included into the solution
with their source files visible and editable, and the build system
was aware of the dependencies. At least on Visual Studio 2008.<br>
<br>
Switching to Visual Studio 2012, it is not possible to use
INCLUDE_EXTERMAL_MSPROJECT(...) anyomre
(<a class="moz-txt-link-freetext" href="http://www.cmake.org/Bug/view.php?id=14897">http://www.cmake.org/Bug/view.php?id=14897</a>). As suggested, I tried
to solve the problem using<tt> </tt><a
href="http://www.cmake.org/cmake/help/v3.0/module/ExternalProject.html">ExternalProject_Add(...)</a>,
but unfortunately I cannot make it work this way. Before I post
another but I would like to ask you for any ideas.<br>
<br>
A simple example:<br>
<br>
------------ Sln1/CMakeLists.txt ----------------------<br>
<font color="#990000"><tt>cmake_minimum_required(VERSION 2.8)</tt><tt><br>
</tt><tt>project(project1)</tt><tt><br>
</tt><tt>ADD_LIBRARY (project1 STATIC main.cpp)</tt></font><br>
<br>
------------ Sln2/CMakeLists.txt ----------------------<br>
<font color="#006600"><tt>cmake_minimum_required(VERSION 2.8)</tt><tt><br>
</tt><tt>project(project1)</tt><tt><br>
</tt><tt>ADD_LIBRARY (project1 STATIC main.cpp)<br>
<br>
</tt><tt></tt><tt>include(ExternalProject)<br>
ExternalProject_Add(project1 SOURCE_DIR ../Sln1)</tt></font><br>
<br>
<br>
I cmake both projects and open the resulting solution
Sln2/project2.sln with Visual Studio. There are two poblems:<br>
Problem 1: project1 is included in the solution, but the source file
is not visible<br>
Problem 2: If I build the solution I get the following error message:<br>
<br>
<font color="#000099"><tt>1>------ Build started: Project:
ZERO_CHECK, Configuration: Debug Win32 ------</tt><tt><br>
</tt><tt>1> Checking Build System</tt><tt><br>
</tt><tt>1> CMake does not need to re-run because <font
color="#ff0000">[...]</font>/Sln2/CMakeFiles/generate.stamp is
up-to-date.</tt><tt><br>
</tt><tt>2>------ Build started: Project: project1,
Configuration: Debug Win32 ------</tt><tt><br>
</tt><tt>3>------ Build started: Project: project2,
Configuration: Debug Win32 ------</tt><tt><br>
</tt><tt>2> Building Custom Rule </tt></font><font
color="#000099"><tt><font color="#000099"><tt><font
color="#ff0000">[...]</font></tt></font>/Sln2/CMakeLists.txt</tt><tt><br>
</tt><tt>2> CMake does not need to re-run because </tt></font><font
color="#000099"><tt><font color="#000099"><tt><font
color="#ff0000">[...]</font></tt></font>\Sln2\CMakeFiles\generate.stamp
is up-to-date.</tt><tt><br>
</tt><tt>2> Creating directories for 'project1'</tt><tt><br>
</tt><tt>2> No download step for 'project1'</tt><tt><br>
</tt><tt>2> No update step for 'project1'</tt><tt><br>
</tt><tt>2> No patch step for 'project1'</tt><tt><br>
</tt><tt>2> Performing configure step for 'project1'</tt><tt><br>
</tt><tt>3> Building Custom Rule </tt></font><font
color="#000099"><tt><font color="#000099"><tt><font
color="#ff0000">[...]</font></tt></font>/Sln2/CMakeLists.txt</tt><tt><br>
</tt><tt>3> CMake does not need to re-run because </tt></font><font
color="#000099"><tt><font color="#000099"><tt><font
color="#ff0000">[...]</font></tt></font>\Sln2\CMakeFiles\generate.stamp
is up-to-date.</tt><tt><br>
</tt><tt>2> -- Configuring done</tt><tt><br>
</tt><tt>2> -- Generating done</tt><tt><br>
</tt><tt>2> -- Build files have been written to: </tt></font><font
color="#000099"><tt><font color="#000099"><tt><font
color="#ff0000">[...]</font></tt></font>/Sln1</tt><tt><br>
</tt><tt>3> main.cpp</tt><tt><br>
</tt><font color="#ff0000"><b><tt>2> Performing build step for
'project1'</tt></b><b><tt><br>
</tt><tt>2>CUSTOMBUILD : error : could not load cache</tt></b></font><tt><br>
</tt><tt>3> project2.vcxproj -> </tt></font><font
color="#000099"><tt><font color="#000099"><tt><font
color="#ff0000">[...]</font></tt></font>\Sln2\Debug\project2.lib</tt><tt><br>
</tt><tt>4>------ Skipped Build: Project: ALL_BUILD,
Configuration: Debug Win32 ------</tt><tt><br>
</tt><tt>4>Project not selected to build for this solution
configuration </tt><tt><br>
</tt><tt>========== Build: 2 succeeded, 1 failed, 0 up-to-date, 1
skipped ==========</tt></font><br>
<br>
Is this supposed to work or is it my mistake? Do you have any
suggestions what I can do to make this simple example run? <br>
In case that you want to try it yourself I attatch the two examples
to this email:<br>
<br>
1. cmake.include_external_msproject.bug.zip: Original attempt using
INCLUDE_EXTERMAL_MSPROJECT(...). Works with Visual Studio 2008
generator but not with Visual Studio 2012 generator.<br>
<br>
2. cmake.externalproject_add.bug.zip: Suggested attempt using <a
href="http://www.cmake.org/cmake/help/v3.0/module/ExternalProject.html">ExternalProject_Add(...)</a>.
Fails with 2008 and 2012. <br>
<br>
Thanks a lot for any suggestions.<br>
Jürgen<br>
</body>
</html>