[CMake] add_custom_command scope

Lars laasunde at hotmail.com
Tue Jan 19 06:30:39 EST 2016


 Hello,
 
Using CMake 3.3 and VS2012.
 
The below cmake scripts generate "Policy CMP0040 is not set: The target in the TARGET signature of add_custom_command must exists". Why cannot the custom/CMakeLists.txt file see the target created in app/CMakeLists.txt ? Moving the ADD_CUSTOM_COMMAND to the app/CMakeLists.txt fixes the problem but I would like to keep them separate if possible.
 
PROJECT(TEST)
ADD_DIRECTORY(app)
ADD_DIRECTORY(custom)
 
The app CMakeLists.txt looks like this;
ADD_EXECUTABLE(app main.cpp)
TARGET_LINK_LIBRARIES(app)
 
The custom CMakeLists.txt looks like this;
ADD_CUSTOM_COMMAND(
  TARGET app 
  POST_BUILD
  COMMAND tbd.exe)
 
Appreciate any input.
 
Kind regards, Lars
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160119/a24fc648/attachment.html>


More information about the CMake mailing list