[CMake]: Bug in ADD_LIBRARY

wedekind wedekind at caesar.de
Thu Jan 4 12:38:53 EST 2007


Hello all,

I guess, I've found a bug in ADD_LIBRARY. As you know, its syntax is:

ADD_LIBRARY(libname [SHARED | STATIC | MODULE] [EXCLUDE_FROM_ALL]
            source1 source2 ... sourceN)

If you specify both EXCLUDE_FROM_ALL _and_ [SHARED | STATIC | MODULE],
EXCLUDE_FROM_ALL is not considered, e.g.:

ADD_LIBRARY(someLib SHARED EXCLUDE_FROM_ALL someCode.cpp)

The ADD_LIBRARY command is not checking for a third argument to ADD_LIBRARY
in "bool cmAddLibraryCommand::InitialPass(...)".

Adding this:

  if(s != args.end())
  {
      if(*s == "EXCLUDE_FROM_ALL")
      {
         ++s;
         in_all = false;
      }
  }

after checking the second argument to ADD_LIBRARY should fix it.

Maybe other commands using EXCLUDE_FROM_ALL are also affected?

I am using a 1-month old check-out of CMake from cvs. I cannot update at the
moment... Did you already fix this?

Cheers

Marco




More information about the CMake mailing list