Hello

I want to link a library to a custom target:

add_custom_command(
  OUTPUT ${FILE}
  DEPENDS ${SRC}
  COMMAND ${EXECUTABLE}
  ARGS ${SRC}
  COMMENT "Generating ${FILE}"
  VERBATIM)

add_custom_target(mytarget ALL
  DEPENDS ${FILE})

target_link_libraries(mytarget /usr/local/lib/libmylib.so)

But it don't seems to work instead I have to use:

add_custom_command(
  OUTPUT ${FILE}
  DEPENDS ${SRC}
  COMMAND ${EXECUTABLE}
  ARGS ${SRC}
  ARGS -I${CPPLIB_INCLUDE_DIR} -L${CPPLIB_DIR} -lmylib
  COMMENT "Generating ${FILE}"
  VERBATIM)

add_custom_target(mytarget ALL
  DEPENDS ${FILE})

Why is this so? Can't I use target_link_library with add_custom_target?

Thnaks for clarification!

Cheers Reza
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to