Thanks for the explanation, Craig. Is there a way to detect if the target was a 
physical file created using add_library/add_executable, or a utility target 
created using add_custom_target  in order to conditionally call the 
target_link_libraries command ? There is the condition if(TARGET target-name) , 
but according to the documentation it returns true for any existing logical 
target name such as those created by the  
<https://cmake.org/cmake/help/v3.0/command/add_executable.html#command:add_executable>
 add_executable(),  
<https://cmake.org/cmake/help/v3.0/command/add_library.html#command:add_library>
 add_library(), or  
<https://cmake.org/cmake/help/v3.0/command/add_custom_target.html#command:add_custom_target>
 add_custom_target() commands. 

 

From: Craig Scott [mailto:craig.sc...@crascit.com] 
Sent: Monday, July 25, 2016 1:52 PM
To: Azharuddin Mohammed <azhar...@codeaurora.org>
Cc: CMake <cmake@cmake.org>
Subject: Re: [CMake] What is a utility target ?

 

In the context of that particular part of the CMake documentation, it is 
referring to targets that are not created by add_library() or add_executable(). 
Targets created by add_custom_target() are not something CMake knows what to do 
with if you give them to the target_link_libraries() command, since these 
custom targets may not (and typically won't) correspond to a physical file 
being created (that's what add_custom_command() is for). So the term utility 
target can be thought of as being a custom target you create for convenience, 
but not something which actually corresponds to a library or executable. 
Examples of utility targets that CMake will automatically create for you 
include things like all, test, package, etc.

 

 

On Tue, Jul 26, 2016 at 6:39 AM, Azharuddin Mohammed <azhar...@codeaurora.org 
<mailto:azhar...@codeaurora.org> > wrote:

Hi

 

CMake Policy CMP0039 (https://cmake.org/cmake/help/v3.0/policy/CMP0039.html) 
mentions that “Utility targets may not have link dependencies” . Can someone 
please explain what does “utility targets” mean ? 

 

Thanks

 

-

Azhar


--

Powered by www.kitware.com <http://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





 

-- 

Craig Scott

Melbourne, Australia

http://crascit.com

-- 

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