[CMake] Main program not getting rebuilt when library changes.

Bill Greene w.h.greene at gmail.com
Thu Oct 2 15:38:07 EDT 2014


Hi,

I'm trying to build a trivial project with cmake 3.0 and Visual Studio 2013.
The project has a top-level directory, a sub-directory with the main
program,
and a sub-directory that builds a static library that the main program
depends on.
It all builds fine the first time. Then I change a routine in the library
and rebuild.
The static library gets rebuilt but the main program does not get re-linked.

I have perused the cmake-built VS project for hours and it looks fine to
me; the
main program depends on the library as expected. I can't figure out why the
main
program is not being rebuilt.

More embarrassing, I can easily build a similar VS project by hand that
behaves as
expected but I can' find the significant difference between the two that is
causing the
problematic behavior.

If anyone has any insights on this I would be very appreciative.

Here are my three CMakeLists.txt files:

top level:
-----------
cmake_minimum_required (VERSION 2.8)
project(cmTest)
add_subdirectory (cmTestMain)
add_subdirectory (cmTestLib)

cmTestLib
--------------
FILE(GLOB SRC *.cpp)
FILE(GLOB H_FILES *.h)
add_library (cmTestLib STATIC ${SRC} ${H_FILES})

cmTestMain
----------------
include_directories (${cmTest_SOURCE_DIR}/cmTestLib)
add_executable (cmTestMain cmTestMain.cpp)
target_link_libraries (cmTestMain cmTestLib)

Thanks.

Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141002/7b52b074/attachment.html>


More information about the CMake mailing list