CMakeLists.txt文件写法(6):要求CMake根据指定的源文件生成库文件

ADD_LIBRARY: Add a library to the project using the specified source files.

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

    Adds a library target. SHARED, STATIC or MODULE keywords are used to set the library type. If the keyword MODULE appears, the library type is set to MH_BUNDLE on systems which use dyld. On systems without dyld, MODULE is treated like SHARED. If no keywords appear as the second argument, the type defaults to the current value of BUILD_SHARED_LIBS. If this variable is not set, the type defaults to STATIC.

    If EXCLUDE_FROM_ALL is given the target will not be built by default. It will be built only if the user explicitly builds the target or another target that requires the target depends on it.

     

  • 你可能感兴趣的:(Module,user,Build,library)