I have a project which is configured in several CMakeLists.txt files. The
problem is that add_custom_command works or doesn't work depending on where
the command is located. If I put add_custom_command just after add_library
then it works fine. Like this:
  add_library(mylib SHARED ${SOURCES} ${PRIVATE_HEADERS}
${PUBLIC_HEADERS})
  add_custom_command(TARGET mylib POST_BUILD 
    COMMAND cmd
  )

But when I try to do something like this:
CMakeLists.txt
  add_directory(src)
  add_custom_command(TARGET mylib POST_BUILD 
    COMMAND cmd
  )
src/CMakeLists.txt
  add_library(mylib SHARED ${SOURCES} ${PRIVATE_HEADERS}
${PUBLIC_HEADERS})

Then it doesn't work (no error, just cmd is not executed). Why is that?
And what can I do about it? If this is due to target mylib not being
visible in root CMakeLists.txt then is there a way to forward declare it?
And either way: if the command is not going to work anyway then an error
would be expected IMHO.
-- 
Regards,
Tomasz Grobelny
--

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