diff -r c445c931472f -r 4c8956a7bdf4 CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CMakeLists.txt Sun Dec 05 17:35:23 2010 +0100 @@ -0,0 +1,177 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +SET(PROJECT_NAME "GLPK") +PROJECT(${PROJECT_NAME}) + +IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake) + INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake) +ELSEIF(DEFINED ENV{GLPK_VERSION}) + SET(GLPK_VERSION $ENV{GLPK_VERSION} CACHE STRING "GLPK version string.") +ELSE() + EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} ./scripts/chg-len.py + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE HG_REVISION_PATH + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + EXECUTE_PROCESS( + COMMAND hg id -i + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE HG_REVISION + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + IF(HG_REVISION STREQUAL "") + SET(HG_REVISION_ID "hg-tip") + ELSE() + IF(HG_REVISION_PATH STREQUAL "") + SET(HG_REVISION_ID ${HG_REVISION}) + ELSE() + SET(HG_REVISION_ID ${HG_REVISION_PATH}.${HG_REVISION}) + ENDIF() + ENDIF() + SET(GLPK_VERSION ${HG_REVISION_ID} CACHE STRING "GLPK version string.") +ENDIF() + +SET(PROJECT_VERSION ${GLPK_VERSION}) + +SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +IF(DEFINED ENV{GLPK_C_WARNING}) + SET(C_WARNING $ENV{GLPK_C_WARNING}) +ELSE() + IF(CMAKE_COMPILER_IS_GNUC) + SET(C_WARNING "-Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas") + SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb") + SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb") + ELSEIF(MSVC) + # SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996") + # # suppressed warnings: + # # C4250: 'class1' : inherits 'class2::member' via dominance + # # C4355: 'this' : used in base member initializer list + # # C4503: 'function' : decorated name length exceeded, name was truncated + # # C4800: 'type' : forcing value to bool 'true' or 'false' + # # (performance warning) + # # C4996: 'function': was declared deprecated + ELSE() + SET(C_WARNING "-Wall -W") + ENDIF() +ENDIF() +SET(GLPK_C_WARNING_FLAGS ${C_WARNING} CACHE STRING "GLPK warning flags.") + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GLPK_C_WARNING_FLAGS}") + +SET(CMAKE_C_FLAGS_MAINTAINER "-ggdb" CACHE STRING + "Flags used by the C compiler during maintainer builds." + FORCE ) +SET(CMAKE_EXE_LINKER_FLAGS_MAINTAINER + "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING + "Flags used for linking binaries during maintainer builds." + FORCE ) +SET(CMAKE_SHARED_LINKER_FLAGS_MAINTAINER + "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING + "Flags used by the shared libraries linker during maintainer builds." + FORCE ) +MARK_AS_ADVANCED( + CMAKE_C_FLAGS_MAINTAINER + CMAKE_EXE_LINKER_FLAGS_MAINTAINER + CMAKE_SHARED_LINKER_FLAGS_MAINTAINER ) + +IF(CMAKE_CONFIGURATION_TYPES) + LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer) + LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES) + SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING + "Add the configurations that we need" + FORCE) + endif() + +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "Release") +ENDIF() + +SET(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING + "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer." + FORCE ) + + +INCLUDE(CheckTypeSize) +CHECK_TYPE_SIZE("long long" LONG_LONG) +SET(GLPK_HAVE_LONG_LONG ${HAVE_LONG_LONG}) + +ENABLE_TESTING() + +IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") + ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND}) +ELSE() + ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND}) +ENDIF() + +INCLUDE_DIRECTORIES( + ${PROJECT_SOURCE_DIR}/include + ${PROJECT_SOURCE_DIR}/src +) + +INCLUDE(FindLATEX) + +ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(include) +IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) + ADD_SUBDIRECTORY(examples) + ADD_SUBDIRECTORY(doc) +ENDIF() + +IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) + SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) + SET(CPACK_PACKAGE_VENDOR "GNU") + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY + "GLPK - GNU Linear Programming Kit") + SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING") + + SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) + + SET(CPACK_PACKAGE_INSTALL_DIRECTORY + "${PROJECT_NAME} ${PROJECT_VERSION}") + SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY + "${PROJECT_NAME} ${PROJECT_VERSION}") + + INCLUDE(CPack) + + CPACK_ADD_INSTALL_TYPE(Full) + + CPACK_ADD_COMPONENT(headers + DISPLAY_NAME "C headers" + DESCRIPTION "C header files" + DEPENDS library + INSTALL_TYPES Full + ) + CPACK_ADD_COMPONENT(library + DISPLAY_NAME "Libraries" + DESCRIPTION "DLL and import library" + INSTALL_TYPES Full + ) + + CPACK_ADD_COMPONENT(bin + DISPLAY_NAME "Command line utilities" + DESCRIPTION "Command line utilities" + INSTALL_TYPES Full + ) + + SET(CPACK_GENERATOR "NSIS") + # SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/glpk.ico") + # SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") + # #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") + # SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\glpk.ico") + SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") + SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.gnu.org\\\\software\\\\glpk") + SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.gnu.org\\\\software\\\\glpk") + SET(CPACK_NSIS_CONTACT "mao@gnu.org") + # SET(CPACK_NSIS_CREATE_ICONS_EXTRA " + # CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" + # ") + # SET(CPACK_NSIS_DELETE_ICONS_EXTRA " + # !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP + # Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" + # ") + +ENDIF()