Re: [CMake] add_custom_command doesn't know about target; but get_target_property does

2014-08-22 Thread Nils Gladitz

On 22.08.2014 02:15, Braden McDaniel wrote:

Ah.  Bummer.

Well, as you might have guessed, I'm trying to address an issue where
the LOCATION property of a target (EXPORT_TARGET, in the example above)
was being used.  Is there some way I can get this information about the
target that doesn't involve modifying the CMakeLists.txt in each
subdirectory where a target of interest resides?


Perhaps something like:

file(GENERATE
OUTPUT ${CMAKE_BINARY_DIR}/${LIB_PATHS}/${EXPORT_TARGET}_$CONFIG
CONTENT $TARGET_FILE:${EXPORT_TARGET}
)

Or if you want to keep this at build time a custom command with the 
OUTPUT signature and

e.g. a custom target that depends on that output.

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


Re: [CMake] add_custom_command doesn't know about target; but get_target_property does

2014-08-22 Thread Braden McDaniel
On Fri, 2014-08-22 at 12:37 +0200, Nils Gladitz wrote:
 On 22.08.2014 02:15, Braden McDaniel wrote:
  Ah.  Bummer.
 
  Well, as you might have guessed, I'm trying to address an issue where
  the LOCATION property of a target (EXPORT_TARGET, in the example above)
  was being used.  Is there some way I can get this information about the
  target that doesn't involve modifying the CMakeLists.txt in each
  subdirectory where a target of interest resides?
 
 Perhaps something like:
 
 file(GENERATE
  OUTPUT ${CMAKE_BINARY_DIR}/${LIB_PATHS}/${EXPORT_TARGET}_$CONFIG
  CONTENT $TARGET_FILE:${EXPORT_TARGET}
 )
 
 Or if you want to keep this at build time a custom command with the 
 OUTPUT signature and
 e.g. a custom target that depends on that output.

Actually, I'd rather not do it at build time; I just didn't realize I
could avoid it.  That should work quite nicely.  Thanks!

-- 
Braden McDaniel bra...@endoframe.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


Re: [CMake] add_custom_command doesn't know about target; but get_target_property does

2014-08-22 Thread Braden McDaniel
Nils Gladitz nilsgladitz@... writes:

 Perhaps something like:
 
 file(GENERATE
  OUTPUT ${CMAKE_BINARY_DIR}/${LIB_PATHS}/${EXPORT_TARGET}_$CONFIG
  CONTENT $TARGET_FILE:${EXPORT_TARGET}
 )

Actually, upon closer inspection, it looks like this doesn't work because
 $TARGET_FILE:${EXPORT_TARGET} won't be aware of the current configuration at 
CMake
 configure-time. I'm trying to get the configuration-dependent path of the 
emitted library.
(And I need to support Windows project files.)
 
 Or if you want to keep this at build time a custom command with the 
 OUTPUT signature and
 e.g. a custom target that depends on that output.

It's not clear to me that this approach would solve the above problem.

Braden


-- 

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


Re: [CMake] add_custom_command doesn't know about target; but get_target_property does

2014-08-22 Thread Nils Gladitz

On 22.08.2014 18:18, Braden McDaniel wrote:

Actually, upon closer inspection, it looks like this doesn't work because
  $TARGET_FILE:${EXPORT_TARGET} won't be aware of the current configuration 
at CMake
  configure-time. I'm trying to get the configuration-dependent path of the 
emitted library.
(And I need to support Windows project files.)


It generates one file per configuration (see the $CONFIG generator 
expression at the end of the output filename)
and uses the configuration specific expansion of $TARGET_FILE 
respectively.


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


[CMake] add_custom_command doesn't know about target; but get_target_property does

2014-08-21 Thread Braden McDaniel
I have the following code that executes in a top-level CMakeLists.txt 
*after* having recursed into subdirectories:


get_target_property(TARGET_NAME ${EXPORT_TARGET} NAME)
message(STATUS ${EXPORT_TARGET} NAME = ${TARGET_NAME})
add_custom_command(
TARGET ${EXPORT_TARGET} POST_BUILD
		COMMAND ${CMAKE_COMMAND} -E echo $TARGET_FILE  
${CMAKE_BINARY_DIR}/${LIB_PATHS}/${EXPORT_TARGET}_$CONFIG

)

EXPORT_TARGET is a library target defined in a subdirectory.  This 
results in the following output from CMake:


my_target NAME = my_target
CMake Warning (dev) at CMakeLists.txt:965 (add_custom_command):
  Policy CMP0040 is not set: The target in the TARGET signature of
  add_custom_command() must exist.  Run cmake --help-policy CMP0040 
for

  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  The target name my_target is unknown in this context.

How come get_target_property knows about the target but 
add_custom_command does not?


I am using CMake 3.0.1.

--
Braden McDaniel
bra...@endoframe.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


Re: [CMake] add_custom_command doesn't know about target; but get_target_property does

2014-08-21 Thread Nils Gladitz

On 21.08.2014 22:27, Braden McDaniel wrote:
I have the following code that executes in a top-level CMakeLists.txt 
*after* having recursed into subdirectories:


get_target_property(TARGET_NAME ${EXPORT_TARGET} NAME)
message(STATUS ${EXPORT_TARGET} NAME = ${TARGET_NAME})
add_custom_command(
TARGET ${EXPORT_TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo $TARGET_FILE  
${CMAKE_BINARY_DIR}/${LIB_PATHS}/${EXPORT_TARGET}_$CONFIG

)

EXPORT_TARGET is a library target defined in a subdirectory.  This 
results in the following output from CMake:


my_target NAME = my_target
CMake Warning (dev) at CMakeLists.txt:965 (add_custom_command):
  Policy CMP0040 is not set: The target in the TARGET signature of
  add_custom_command() must exist.  Run cmake --help-policy CMP0040 for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  The target name my_target is unknown in this context.

How come get_target_property knows about the target but 
add_custom_command does not?


I am using CMake 3.0.1.



Custom commands can only be attached to targets defined in the current 
directory.


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