On 16.04.2015 22:01, Daniel Dilts wrote:
I have the following in my lists:
if(TARGET CustomTarget)
message("TARGET CustomTarget")
else()
message("NOT TARGET CustomTarget")
endif()
add_custom_command(TARGET CustomTarget PRE_BUILD
COMMAND CustomCommand.exe
USES_TERMINAL
)
In my output I get:
TARGET CustomTarget
CMake Error at Some/Path/CMakeLists.txt:52 (add_custom_command
):
The target name "CustomTarget" is unknown in this context.
It seems like the if() shows that there is a target with the desired
name. Am I missing something?
You can only modify a target after it has been defined and in the
directory (CMakeLists.txt) that defined it.
The same goes for appending commands to targets.
Nils
--
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://public.kitware.com/mailman/listinfo/cmake