Re: [CMake] Cannot find source file:

2017-06-24 Thread Dan Liew
On 24 June 2017 at 05:06, Sean Wayland  wrote:
> Hi all,
> I am having trouble getting an application to build.
> I keep getting this error "cannot find source file"
>
>
> /Users/seanwayland/Desktop/CATSMAT-masterfri/catsmat/catsmat/Analysis/src/*.cpp
>
> This is the first folder containing sources and when it doesn't find
> anything here it stops.
>
> There are indeed .cpp files in that directory.
> I tried putting a ./ at the start of the directory tree but it didn't help.
>
> My cmake file is below .. I am using CLION 2017.1.1 and OSX 10.12.1
>
> Can anyone shed any light ??

My high level comment would be to not glob for source files. This an
anti-pattern and will break your incremental builds.

For example if you add a new source files say "foo.cpp" and then run
"make" (or whatever your CMake generator is) the build
will fail if "foo.cpp" is actually needed because CMake will not know
it needs to re-configure to discover "foo.cpp" and so will
not try to build "foo.cpp". By listing source files manually in
"CMakeLists.txt" files you will force CMake to re-configure when you
add/remove source files from the build.

I also note you are setting a very old minimum CMake version and are
using the old style condition syntax (condition appears in `endif()`
and `else()`).
I'd really advise you don't use that syntax and set a high minimum
CMake version so you get some of the useful new features in CMake
unless
you have a specific reason for supporting such an old version of CMake.

As for your globbing problem

* This is definitely wrong

```
set (CATSMAT_DIR
./Users/seanwayland/Desktop/CATSMAT-masterfri/catsmat/catsmat/ )
```

The leading `.` means current directory and I doubt there's a `Users`
folder in your current directory.
Also hard coding paths like is very bad style and is not portable.

* This doesn't make sense

```
file (GLOB CORESRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SRC})
```

"${SRC}" is a list of absolute paths but then you tell the `file()`
command to assume the paths are relative
to `${CMAKE_CURRENT_SOURCE_DIR}`.
-- 

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] Cannot find source file: *.rc

2011-05-27 Thread Michael Wild
On 05/26/2011 06:45 PM, aaron_wri...@selinc.com wrote:
 From: Michael Wild them...@gmail.com
 To: cmake@cmake.org
 Date: 05/25/2011 10:08 PM
 Subject: Re: [CMake] Cannot find source file: *.rc
 Sent by: cmake-boun...@cmake.org

 On 05/25/2011 11:40 PM, aaron_wri...@selinc.com wrote:
  I use mc.exe to generate an *.rc file and some headers for my program.
  The *.rc file is listed as an output of a custom command and as a source
  to an executable. During configuration CMake tells me it can't find a
  source file and lists the *.rc file. I've check the generated property
  of the *.rc file and it is true, so why does CMake expect it to be
  present during configuration?
 
  I've tried to make a small example, but when I try to do that everything
  works. What I'm looking for is a reason why it would only effect large
  build systems on not small build system, or why does this only effect
  this *.rc and none of the other twenty or thirty files I generate? Is
  there something special about *.rc files?
 
  I'm really just grabbing at straws here because I've been trying to fix
  this for months, with no luck. So any ideas are welcome.
 
  ---
  Aaron Wright

 Is the add_custom_command call generating the *.rc file in the same
 directory as your add_executable call?

 Michael
 
 It is neither in the same CMakeLists.txt nor is the *.rc file generated
 anywhere close to the executable.
 
 I did work around this by writing a dummy file at configure time with
 FILE(WRITE. Thought that seems a little hacky.

That is the problem. GENERATED source files only seem to work when used
in the same directory.

Michael
___
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


Re: [CMake] Cannot find source file: *.rc

2011-05-27 Thread Michael Hertling
On 05/27/2011 11:46 AM, Michael Wild wrote:
 On 05/26/2011 06:45 PM, aaron_wri...@selinc.com wrote:
 From: Michael Wild them...@gmail.com
 To: cmake@cmake.org
 Date: 05/25/2011 10:08 PM
 Subject: Re: [CMake] Cannot find source file: *.rc
 Sent by: cmake-boun...@cmake.org

 On 05/25/2011 11:40 PM, aaron_wri...@selinc.com wrote:
 I use mc.exe to generate an *.rc file and some headers for my program.
 The *.rc file is listed as an output of a custom command and as a source
 to an executable. During configuration CMake tells me it can't find a
 source file and lists the *.rc file. I've check the generated property
 of the *.rc file and it is true, so why does CMake expect it to be
 present during configuration?

 I've tried to make a small example, but when I try to do that everything
 works. What I'm looking for is a reason why it would only effect large
 build systems on not small build system, or why does this only effect
 this *.rc and none of the other twenty or thirty files I generate? Is
 there something special about *.rc files?

 I'm really just grabbing at straws here because I've been trying to fix
 this for months, with no luck. So any ideas are welcome.

 ---
 Aaron Wright

 Is the add_custom_command call generating the *.rc file in the same
 directory as your add_executable call?

 Michael

 It is neither in the same CMakeLists.txt nor is the *.rc file generated
 anywhere close to the executable.

 I did work around this by writing a dummy file at configure time with
 FILE(WRITE. Thought that seems a little hacky.
 
 That is the problem. GENERATED source files only seem to work when used
 in the same directory.
 
 Michael

This is even documented explicitly: In the CMake manual, search for in
the same directory (CMakeLists.txt file), and see FAQ 4.7. If a custom
command's output is to be referred to from another CMakeLists.txt file,
one must trigger it by a custom target, e.g. Moreover, note that source
properties like GENERATED are not only associated to source files, but
also restricted to directories, i.e. a source file marked as GENERATED
in one CMakeLists.txt won't bear this mark in another CMakeLists.txt.

Regards,

Michael
___
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


Re: [CMake] Cannot find source file: *.rc

2011-05-26 Thread Aaron_Wright
 From: Michael Wild them...@gmail.com
 To: cmake@cmake.org
 Date: 05/25/2011 10:08 PM
 Subject: Re: [CMake] Cannot find source file: *.rc
 Sent by: cmake-boun...@cmake.org
 
 On 05/25/2011 11:40 PM, aaron_wri...@selinc.com wrote:
  I use mc.exe to generate an *.rc file and some headers for my program.
  The *.rc file is listed as an output of a custom command and as a 
source
  to an executable. During configuration CMake tells me it can't find a
  source file and lists the *.rc file. I've check the generated property
  of the *.rc file and it is true, so why does CMake expect it to be
  present during configuration?
  
  I've tried to make a small example, but when I try to do that 
everything
  works. What I'm looking for is a reason why it would only effect large
  build systems on not small build system, or why does this only effect
  this *.rc and none of the other twenty or thirty files I generate? Is
  there something special about *.rc files?
  
  I'm really just grabbing at straws here because I've been trying to 
fix
  this for months, with no luck. So any ideas are welcome.
  
  ---
  Aaron Wright
 
 Is the add_custom_command call generating the *.rc file in the same
 directory as your add_executable call?
 
 Michael

It is neither in the same CMakeLists.txt nor is the *.rc file generated 
anywhere close to the executable.

I did work around this by writing a dummy file at configure time with 
FILE(WRITE. Thought that seems a little hacky.___
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

Re: [CMake] Cannot find source file: *.rc

2011-05-25 Thread Michael Wild
On 05/25/2011 11:40 PM, aaron_wri...@selinc.com wrote:
 I use mc.exe to generate an *.rc file and some headers for my program.
 The *.rc file is listed as an output of a custom command and as a source
 to an executable. During configuration CMake tells me it can't find a
 source file and lists the *.rc file. I've check the generated property
 of the *.rc file and it is true, so why does CMake expect it to be
 present during configuration?
 
 I've tried to make a small example, but when I try to do that everything
 works. What I'm looking for is a reason why it would only effect large
 build systems on not small build system, or why does this only effect
 this *.rc and none of the other twenty or thirty files I generate? Is
 there something special about *.rc files?
 
 I'm really just grabbing at straws here because I've been trying to fix
 this for months, with no luck. So any ideas are welcome.
 
 ---
 Aaron Wright
 Software Engineer - Synchrophasors
 Schweitzer Engineering Laboratories, Inc.
 Pullman, WA 99163
 509-334-8087

Is the add_custom_command call generating the *.rc file in the same
directory as your add_executable call?

Michael

___
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


Re: [CMake] Cannot find source file.

2009-12-15 Thread Tim St. Clair
I would contend that this should be a warning vs. an error, which
prevents generation.

Cheers,
Tim

On Thu, Dec 10, 2009 at 3:18 PM, Alexander Neundorf
a.neundorf-w...@gmx.net wrote:
 On Thursday 10 December 2009, Tyler Roscoe wrote:
 On Thu, Dec 10, 2009 at 02:14:28PM -0600, Tim St. Clair wrote:
  Do all files *have* to be present during generation? Or is there some
  lazy evaluation?

 Look at the GENERATED property for source files.

  The file it is looking for is one of many gen'd files.  It would be a
  pain if I had to update all the command outputs in order to create the
  deps.

 Having well-constructed links between command outputs and dependencies
 sounds like a really good idea to me.

 Yes, it's even necessary. If your add_custom_commands() don't list all the
 files they generate and if not all generated files are listed as sources for
 the target which needs them then the dependencies will be incomplete, and
 builds (or at least parallel builds) will break.

 Alex




-- 
Cheers,
Timothy St. Clair
___
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


Re: [CMake] Cannot find source file.

2009-12-10 Thread Tyler Roscoe
On Thu, Dec 10, 2009 at 02:14:28PM -0600, Tim St. Clair wrote:
 Do all files *have* to be present during generation? Or is there some
 lazy evaluation?

Look at the GENERATED property for source files.

 The file it is looking for is one of many gen'd files.  It would be a
 pain if I had to update all the command outputs in order to create the
 deps.

Having well-constructed links between command outputs and dependencies
sounds like a really good idea to me.

tyler
___
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


Re: [CMake] Cannot find source file.

2009-12-10 Thread Alexander Neundorf
On Thursday 10 December 2009, Tyler Roscoe wrote:
 On Thu, Dec 10, 2009 at 02:14:28PM -0600, Tim St. Clair wrote:
  Do all files *have* to be present during generation? Or is there some
  lazy evaluation?

 Look at the GENERATED property for source files.

  The file it is looking for is one of many gen'd files.  It would be a
  pain if I had to update all the command outputs in order to create the
  deps.

 Having well-constructed links between command outputs and dependencies
 sounds like a really good idea to me.

Yes, it's even necessary. If your add_custom_commands() don't list all the 
files they generate and if not all generated files are listed as sources for 
the target which needs them then the dependencies will be incomplete, and 
builds (or at least parallel builds) will break.

Alex
___
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