alpar@2: CMAKE_MINIMUM_REQUIRED(VERSION 2.6) alpar@2: alpar@2: SET(PROJECT_NAME "GLPK") alpar@2: PROJECT(${PROJECT_NAME}) alpar@2: alpar@2: IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake) alpar@2: INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake) alpar@2: ELSEIF(DEFINED ENV{GLPK_VERSION}) alpar@2: SET(GLPK_VERSION $ENV{GLPK_VERSION} CACHE STRING "GLPK version string.") alpar@2: ELSE() alpar@2: EXECUTE_PROCESS( alpar@2: COMMAND ${PYTHON_EXECUTABLE} ./scripts/chg-len.py alpar@2: WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} alpar@2: OUTPUT_VARIABLE HG_REVISION_PATH alpar@2: ERROR_QUIET alpar@2: OUTPUT_STRIP_TRAILING_WHITESPACE alpar@2: ) alpar@2: EXECUTE_PROCESS( alpar@2: COMMAND hg id -i alpar@2: WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} alpar@2: OUTPUT_VARIABLE HG_REVISION alpar@2: ERROR_QUIET alpar@2: OUTPUT_STRIP_TRAILING_WHITESPACE alpar@2: ) alpar@2: IF(HG_REVISION STREQUAL "") alpar@2: SET(HG_REVISION_ID "hg-tip") alpar@2: ELSE() alpar@2: IF(HG_REVISION_PATH STREQUAL "") alpar@2: SET(HG_REVISION_ID ${HG_REVISION}) alpar@2: ELSE() alpar@2: SET(HG_REVISION_ID ${HG_REVISION_PATH}.${HG_REVISION}) alpar@2: ENDIF() alpar@2: ENDIF() alpar@2: SET(GLPK_VERSION ${HG_REVISION_ID} CACHE STRING "GLPK version string.") alpar@2: ENDIF() alpar@2: alpar@2: SET(PROJECT_VERSION ${GLPK_VERSION}) alpar@2: alpar@2: SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) alpar@2: alpar@2: IF(DEFINED ENV{GLPK_C_WARNING}) alpar@2: SET(C_WARNING $ENV{GLPK_C_WARNING}) alpar@2: ELSE() alpar@2: IF(CMAKE_COMPILER_IS_GNUC) alpar@2: 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") alpar@2: SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb") alpar@2: SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb") alpar@2: ELSEIF(MSVC) alpar@2: # SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996") alpar@2: # # suppressed warnings: alpar@2: # # C4250: 'class1' : inherits 'class2::member' via dominance alpar@2: # # C4355: 'this' : used in base member initializer list alpar@2: # # C4503: 'function' : decorated name length exceeded, name was truncated alpar@2: # # C4800: 'type' : forcing value to bool 'true' or 'false' alpar@2: # # (performance warning) alpar@2: # # C4996: 'function': was declared deprecated alpar@2: ELSE() alpar@2: SET(C_WARNING "-Wall -W") alpar@2: ENDIF() alpar@2: ENDIF() alpar@2: SET(GLPK_C_WARNING_FLAGS ${C_WARNING} CACHE STRING "GLPK warning flags.") alpar@2: alpar@2: SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GLPK_C_WARNING_FLAGS}") alpar@2: alpar@2: SET(CMAKE_C_FLAGS_MAINTAINER "-ggdb" CACHE STRING alpar@2: "Flags used by the C compiler during maintainer builds." alpar@2: FORCE ) alpar@2: SET(CMAKE_EXE_LINKER_FLAGS_MAINTAINER alpar@2: "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING alpar@2: "Flags used for linking binaries during maintainer builds." alpar@2: FORCE ) alpar@2: SET(CMAKE_SHARED_LINKER_FLAGS_MAINTAINER alpar@2: "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING alpar@2: "Flags used by the shared libraries linker during maintainer builds." alpar@2: FORCE ) alpar@2: MARK_AS_ADVANCED( alpar@2: CMAKE_C_FLAGS_MAINTAINER alpar@2: CMAKE_EXE_LINKER_FLAGS_MAINTAINER alpar@2: CMAKE_SHARED_LINKER_FLAGS_MAINTAINER ) alpar@2: alpar@2: IF(CMAKE_CONFIGURATION_TYPES) alpar@2: LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer) alpar@2: LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES) alpar@2: SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING alpar@2: "Add the configurations that we need" alpar@2: FORCE) alpar@2: endif() alpar@2: alpar@2: IF(NOT CMAKE_BUILD_TYPE) alpar@2: SET(CMAKE_BUILD_TYPE "Release") alpar@2: ENDIF() alpar@2: alpar@2: SET(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING alpar@2: "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer." alpar@2: FORCE ) alpar@2: alpar@2: alpar@2: INCLUDE(CheckTypeSize) alpar@2: CHECK_TYPE_SIZE("long long" LONG_LONG) alpar@2: SET(GLPK_HAVE_LONG_LONG ${HAVE_LONG_LONG}) alpar@2: alpar@2: ENABLE_TESTING() alpar@2: alpar@2: IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") alpar@2: ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND}) alpar@2: ELSE() alpar@2: ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND}) alpar@2: ENDIF() alpar@2: alpar@2: INCLUDE_DIRECTORIES( alpar@2: ${PROJECT_SOURCE_DIR}/include alpar@2: ${PROJECT_SOURCE_DIR}/src alpar@2: ) alpar@2: alpar@2: INCLUDE(FindLATEX) alpar@2: alpar@2: ADD_SUBDIRECTORY(src) alpar@2: ADD_SUBDIRECTORY(include) alpar@2: IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) alpar@2: ADD_SUBDIRECTORY(examples) alpar@2: ADD_SUBDIRECTORY(doc) alpar@2: ENDIF() alpar@2: alpar@2: IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) alpar@2: SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) alpar@2: SET(CPACK_PACKAGE_VENDOR "GNU") alpar@2: SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY alpar@2: "GLPK - GNU Linear Programming Kit") alpar@2: SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING") alpar@2: alpar@2: SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) alpar@2: alpar@2: SET(CPACK_PACKAGE_INSTALL_DIRECTORY alpar@2: "${PROJECT_NAME} ${PROJECT_VERSION}") alpar@2: SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY alpar@2: "${PROJECT_NAME} ${PROJECT_VERSION}") alpar@2: alpar@2: INCLUDE(CPack) alpar@2: alpar@2: CPACK_ADD_INSTALL_TYPE(Full) alpar@2: alpar@2: CPACK_ADD_COMPONENT(headers alpar@2: DISPLAY_NAME "C headers" alpar@2: DESCRIPTION "C header files" alpar@2: DEPENDS library alpar@2: INSTALL_TYPES Full alpar@2: ) alpar@2: CPACK_ADD_COMPONENT(library alpar@2: DISPLAY_NAME "Libraries" alpar@2: DESCRIPTION "DLL and import library" alpar@2: INSTALL_TYPES Full alpar@2: ) alpar@2: alpar@2: CPACK_ADD_COMPONENT(bin alpar@2: DISPLAY_NAME "Command line utilities" alpar@2: DESCRIPTION "Command line utilities" alpar@2: INSTALL_TYPES Full alpar@2: ) alpar@2: alpar@2: SET(CPACK_GENERATOR "NSIS") alpar@2: # SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/glpk.ico") alpar@2: # SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") alpar@2: # #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") alpar@2: # SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\glpk.ico") alpar@2: SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") alpar@2: SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.gnu.org\\\\software\\\\glpk") alpar@2: SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.gnu.org\\\\software\\\\glpk") alpar@2: SET(CPACK_NSIS_CONTACT "mao@gnu.org") alpar@2: # SET(CPACK_NSIS_CREATE_ICONS_EXTRA " alpar@2: # CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" alpar@2: # ") alpar@2: # SET(CPACK_NSIS_DELETE_ICONS_EXTRA " alpar@2: # !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP alpar@2: # Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" alpar@2: # ") alpar@2: alpar@2: ENDIF()