    message (STATUS "Building static libraries.")
    set (LIB_TYPE STATIC)
 +	if(WIN32)
-+		add_definitions(-DCMINPACK_NO_DLL)
++		#add_definitions(-DCMINPACK_NO_DLL)
 +	endif(WIN32)
  endif (SHARED_LIBS)
  

+  list(APPEND CPACK_GENERATOR "PackageMaker")
+endif(EXISTS ${PACKAGE_MAKER_PROGRAM})
+ 
+set(CPACK_GENERATOR "${CPACK_GENERATOR}")
+set(CPACK_MONOLITHIC_INSTALL 1)
+set(CPACK_PACKAGE_VERSION_MAJOR "@CMINPACK_MAJOR_VERSION@")

-add_library (cminpack ${LIB_TYPE} ${cminpack_srcs})
+add_library (cminpack SHARED ${cminpack_srcs})
+add_library (cminpack_static STATIC ${cminpack_srcs}) 
+set_target_properties(cminpack_static  PROPERTIES ARCHIVE_OUTPUT_NAME cminpack_s COMPILE_DEFINITIONS CMINPACK_NO_DLL)
+add_library (cminpack-debug SHARED ${cminpack_srcs})
+set_target_properties(cminpack-debug PROPERTIES OUTPUT_NAME cminpack-gd COMPILE_FLAGS ${CMAKE_CXX_FLAGS_DEBUG})
+add_library (cminpack_static-debug STATIC ${cminpack_srcs}) 
+set_target_properties(cminpack_static-debug PROPERTIES OUTPUT_NAME cminpack_s-gd COMPILE_FLAGS ${CMAKE_CXX_FLAGS_DEBUG} COMPILE_DEFINITIONS CMINPACK_NO_DLL)
 
-install (TARGETS cminpack 
+install (TARGETS cminpack cminpack_static cminpack-debug cminpack_static-debug
    LIBRARY DESTINATION ${CMINPACK_LIB_INSTALL_DIR} COMPONENT library
    ARCHIVE DESTINATION ${CMINPACK_LIB_INSTALL_DIR} COMPONENT library
    RUNTIME DESTINATION ${CMINPACK_LIB_INSTALL_DIR} COMPONENT library)
@@ -67,3 +77,40 @@
 
 set_target_properties(cminpack PROPERTIES VERSION ${CMINPACK_VERSION})
 
