[CMake] Single line crashes cmake

Brandon Van Every bvanevery at gmail.com
Mon Nov 5 16:58:38 EST 2007


On Nov 5, 2007 4:36 PM, Joseph Garvin <k04jg02 at gmail.com> wrote:
> I'm trying to find all folders matching the pattern "blitz-[0-9].[0-9]" so
> it would match blitz-0.3, blitz-2.4, etc. within the folders C:\ and
> C:\Program Files. Starting to code this I put this in an otherwise empty
> .cmake file:
>
> FILE(GLOB BLITZ_TMP "C:/" "blitz-[0-9].[0-9]")
> MESSAGE(${BLITZ_TMP})
>
> Then I included it from the CMakeLists.txt for my project. CMake crashes on
> the first line (i.e. commenting out the second doesn't prevent the crash),
> running v2.4 under Vista saying, "CMakeSetup MFC application has stopped
> working".
>
> What am I doing wrong?

I put your 2 lines into a file called glob.cmake.  Then I ran it as a
script, using a Windows Vista Command Prompt.  I got the following
results:

C:\devel\src\cbugs\glob>cmake -P glob.cmake
CMake Error: Error in cmake code at
C:/devel/src/cbugs/glob/glob.cmake:3:
message called with incorrect number of arguments
   Called from: [1]     C:/devel/src/cbugs/glob/glob.cmake

C:\devel\src\cbugs\glob>

Thus: the glob expressions didn't match anything in my current
directory, BLITZ_TMP was null, and MESSAGE fails because it has been
handed no arguments.  Generally you need MESSAGE("${myvariable}").

When I include the glob.cmake in a CMakeLists.txt, CMakeSetup crashes
as you described.  I am wondering why CMakeSetup can't be more
informative about the error.


Cheers,
Brandon Van Every


More information about the CMake mailing list