Re: [CMake] add_custom_commmand TARGET is unknown

2015-04-16 Thread Nils Gladitz
On 16.04.2015 22:25, Daniel Dilts wrote: You can only add commands to a target that was defined in the current directory? So, I would have to have a new target for each directory and then have a target that depends on all of those targets? I don't know your use case so I can not comment on wh

Re: [CMake] add_custom_commmand TARGET is unknown

2015-04-16 Thread Daniel Dilts
You can only add commands to a target that was defined in the current directory? So, I would have to have a new target for each directory and then have a target that depends on all of those targets? On Thu, Apr 16, 2015 at 1:08 PM, Nils Gladitz wrote: > On 16.04.2015 22:01, Daniel Dilts wrote:

Re: [CMake] add_custom_commmand TARGET is unknown

2015-04-16 Thread Nils Gladitz
On 16.04.2015 22:01, Daniel Dilts wrote: I have the following in my lists: if(TARGET CustomTarget) message("TARGET CustomTarget") else() message("NOT TARGET CustomTarget") endif() add_custom_command(TARGET CustomTarget PRE_BUILD COMMAND CustomCommand.exe USES_TERMINAL ) In my output I

Re: [CMake] add_custom_commmand TARGET is unknown

2015-04-16 Thread Daniel Dilts
I have the following in my lists: if(TARGET CustomTarget) message("TARGET CustomTarget") else() message("NOT TARGET CustomTarget") endif() add_custom_command(TARGET CustomTarget PRE_BUILD COMMAND CustomCommand.exe USES_TERMINAL ) In my output I get: TARGET CustomTarget CMake Error at Som

Re: [CMake] add_custom_commmand TARGET is unknown

2015-04-16 Thread Daniel Dilts
I moved the add_custom_target to the 4th line of my top-level CMakeLists.txt. The only lines before it are cmake_minimum_required, project, and a single set. I also made sure that the name of the target matches the target name in add_custom_command and add_dependencies. I am still getting the sa

Re: [CMake] add_custom_commmand TARGET is unknown

2015-04-15 Thread Mark Abraham
Hi, CMakeLists.txt files are processed from start to finish, so if you want to refer to a target created in a subdirectory, then you need to have added that subdirectory before using that target. Mark On 16/04/2015 1:25 am, "Daniel Dilts" wrote: > I have a function that does something like thi

[CMake] add_custom_commmand TARGET is unknown

2015-04-15 Thread Daniel Dilts
I have a function that does something like this: add_dependencies(${LibraryName} SomeTarget) add_custom_command(TARGET SomeTarget PRE_BUILD COMMAND MyExecutable.exe USES_TERMINAL ) It creates the dependency without any issues, but it gives the following error on the custom command: CMake