I have the following macro.

macro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)

    if(${LIBTYPE} STREQUAL "SHARED")
        set(LIBRARY_NAME "${LIBNAME}_SHARED")
    else()
        set(LIBRARY_NAME "${LIBNAME}")
    endif(${LIBTYPE} STREQUAL "SHARED")

    add_library(${LIBRARY_NAME} ${LIBTYPE} ${LIBFILES})

    if(_MSC_VER AND ${LIBTYPE} STREQUAL "SHARED")
        set_target_properties(${LIBRARY_NAME}
            PROPERTIES
            OUTPUT_NAME "${LIBNAME}dll"
            DEBUG_OUTPUT_NAME "${LIBNAME}dll${DEBUG_LIB_SUFFIX}"
            COMPILE_DEFINITIONS "FL_DLL"
            )
    else()
        set_target_properties(${LIBRARY_NAME}
            PROPERTIES
            OUTPUT_NAME "${LIBNAME}"
            DEBUG_OUTPUT_NAME "${LIBNAME}${DEBUG_LIB_SUFFIX}"
            )
    endif(_MSC_VER AND ${LIBTYPE} STREQUAL "SHARED")

    set_target_properties(${LIBRARY_NAME}
        PROPERTIES
        CLEAN_DIRECT_OUTPUT TRUE
        COMPILE_DEFINITIONS "FL_LIBRARY"
        )

    if(${LIBTYPE} STREQUAL "SHARED")
        set_target_properties(${LIBRARY_NAME}
            PROPERTIES
            VERSION ${FLTK_VERSION_FULL}
            SOVERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
            )
    endif(${LIBTYPE} STREQUAL "SHARED")

    if(_MSC_VER)
        if(OPTION_LARGE_FILE)
            set_target_properties(${LIBRARY_NAME}
                PROPERTIES
                LINK_FLAGS /LARGEADDRESSAWARE
                )
        endif(OPTION_LARGE_FILE)
    endif(_MSC_VER)

    list(APPEND LIBRARIES "${LIBRARY_NAME}")

endmacro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)

I pass it the library name followed by either STATIC or SHARED and a list of files to build the expected library. For each library I build I first pass STATIC then call it again with SHARED.

Under Linux this generates for library a
liba.a liba.so.1.3.2 with the links liba.so.1.3.2 and liba.so.1.3.
All is good

With TDM-GCC under Windows I get liba.a liba.dll and liba.dll.a
Again all is good.

With VS Express 2013 I get a.dll a.ilk a.lib and a.pdb

What I want is a.lib (static library) adll.lib (dynamic loader) and adll.dll (dynamic library)

How do I go from what I have to what I want?

Any pointers, insights or suggestions welcome.

Mike



--

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://www.cmake.org/mailman/listinfo/cmake

Reply via email to