Hi,

I’m trying to print a message for a particular build target and am a bit stuck. 
 I found that the IF statement has a TARGET keyword that should truthfully 
match for a particular build target, but it doesn’t seem to be working at least 
the way I’m trying to use it and would expect it to work.  Snippet in question 
in a top-level CMakeLists.txt file looks like this:

if (TARGET check)
  message(“special note about CHECK target…”)
elseif (TARGET test)
  message(“different note about TEST target…”)
endif (TARGET check)

Now what happens is that the CHECK message is printed … during cmake(!).  What 
I’m trying to achieve is only have those messages printed during≈ “make check” 
and “make test”, etc.  Ideally, I want to be able to inject a message before 
any target actions are taken and possibly after.

I see in the docs that I can set COMMENT during add_custom_target(check …) and 
that should print my message before any target actions, but how can I get a 
similar message printed during ‘test’ or ‘all’ or some other implicit target?  
Is there a better or more general way?  Thanks for your assistance.

Cheers!
Sean

-- 

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

Reply via email to