On Sun, 2014-02-16 at 21:35 -0500, Paul Smith wrote:
> I'm using CMake 2.8.12.1 on Linux, MacOS, and Windows. On Windows I'm
> using MSVC 2010 and the Visual Studio generator, but I have only
> remote access so I'm invoking my builds using devenv (not running
> Visual Studio).
Here's a simplified repro case (this is run from a Git shell, just
because I can't manage command.com; but I've run it from there with
identical results):
$ cd cmtest
$ cat CMakeFiles.txt
cmake_minimum_required(VERSION 2.8.12)
project(TEST C CXX)
add_custom_command(OUTPUT bar.cpp
COMMAND cmake -E copy ${CMAKE_CURRENT_SOURCE_DIR}/foo.cpp bar.cpp
DEPENDS foo.cpp
COMMENT "Creating bar.cpp")
add_library(Bar STATIC base.cpp bar.cpp)
add_library(BarDLL SHARED base.cpp bar.cpp)
$ cat base.cpp
int base = 0;
int restbase()
{
return base;
}
$ cat foo.cpp
int foo = 0;
int restfoo()
{
return foo;
}
For simplicity of cleaning I'll use a remote directory build:
$ mkdir ../cmobj
$ cd ../cmobj
$ cmake ../cmtest
$ cmake --build .
Now in the results you'll see that the "Creating bar.cpp" is printed
twice, showing that the custom command is run twice.
This doesn't happen for makefiles.
How can I structure my cmake file to avoid this double build?
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake