hs.hsadmin/hsacppcli/hsadminc/CMakeLists.txt
Christof Donat c64ab570a1 added more or less resurrected C++ cli client. This will need a lot of
work.

please note, that I would do quite some things differently nowadays. I
home to get those things in via refactoring
2012-04-24 15:15:42 +00:00

130 lines
4.3 KiB
CMake

PROJECT( hsadminc )
CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
#
# look for packages needed for the build to succeed
#
# find boost libraries
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_RUNTIME OFF)
FIND_PACKAGE( Boost 1.44 REQUIRED COMPONENTS date_time filesystem iostreams regex system unit_test_framework thread )
# find doxygen
FIND_PACKAGE( Doxygen 1.7.3 )
# find GnuTLS
FIND_PACKAGE( GnuTLS 2.8.6 REQUIRED )
#
# set compiler and linker flags
#
# compiler
SET( CMAKE_CXX_FLAGS_DEBUG "-g3 -O0" )
SET( CMAKE_CXX_FLAGS_RELEASE "-O3" )
SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g3 -O3" )
SET( CMAKE_CXX_FLAGS_MINSIZEREL "-Os" )
# gcc specific
IF( CMAKE_COMPILER_IS_GNUCC )
SET( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wold-style-cast -pedantic -Wall -Wextra -Winit-self -Wshadow -Wconversion -Wlogical-op -Wnormalized=nfc -Winline -std=c++0x" )
SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++0x" )
SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -std=c++0x" )
SET( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -std=c++0x" )
ENDIF()
#linker
SET( CMAKE_LINK_FLAGS_DEBUG "-g -O0" )
SET( CMAKE_LINK_FLAGS_RELEASE "-O3" )
SET( CMAKE_LINK_FLAGS_RELWITHDEBINFO "-g -O3" )
SET( CMAKE_LINK_FLAGS_MINSIZEREL "-O3" )
# GNU ld specific
IF( CMAKE_COMPILER_IS_GNUCC )
SET( CMAKE_LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_RELEASE} --relax" )
SET( CMAKE_LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE} --relax" )
SET( CMAKE_LINK_FLAGS_RELWITHDEBINFO "${CMAKE_LINK_FLAGS_RELWITHDEBINFO} --relax" )
SET( CMAKE_LINK_FLAGS_MINSIZEREL "${CMAKE_LINK_FLAGS_MINSIZEREL} -s --gc-sections --relax" )
ENDIF()
# build the release as default
SET( CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_RELEASE} )
SET( CMAKE_LINK_FLAGS ${CMAKE_LINK_FLAGS_RELEASE} )
# make sure the boost include files are available
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} )
# all libs that will be linked to hsadminc
SET( HSADMINC_LIB ${Boost_LIBRARIES} gnutls )
# now this is where the source is
ADD_SUBDIRECTORY( source )
# packaging
IF( ${UNIX} )
SET( CPACK_GNERATOR "DEB;RPM;" )
SET( CPACK_PACKAGE_DESCRIPTION "hsadmin command line client" )
SET( CPACK_PACKAGE_DESCRIPTION_SUMMARY "a command line tool to access servers of the configuration tool hsadmin developed by Hostsharing e.G." )
SET( CPACK_PACKAGE_NAME "hsadminc" )
SET( CPACK_DEBIAN_PACKAGE_DEPENDS "boost (>= 1.44), gnutls (>= 2.8.6)" )
SET( CPACK_PACKAGE_CONTACT "Christof Donat" )
SET( CPACK_PACKAGE_VENDOR "Hostsharing e.G." )
SET( CPACK_PACKAGE_VERSION_MAJOR "0" )
SET( CPACK_PACKAGE_VERSION_MINOR "0" )
SET( CPACK_PACKAGE_VERSION_PATCH "1" )
SET( VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}" )
ENDIF()
# currently WIN32 is not supported
#IF( ${WIN32} )
# SET( CPACK_GNERATOR "NSIS;" )
# SET( CPACK_NSIS_MUI_ICON "" )
# SET( CPACK_NSIS_MUI_UNIICON "" )
# SET( CPACK_PACKAGE_ICON "" )
# SET( CPACK_NSIS_EXTRA_INSTALL_COMMANDS "" )
# SET( CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "" )
# SET( CPACK_NSIS_COMPRESSOR "" )
# SET( CPACK_NSIS_MODIFY_PATH "" )
# SET( CPACK_NSIS_DISPLAY_NAME "" )
# SET( CPACK_NSIS_INSTALLED_ICON_NAME "" )
# SET( CPACK_NSIS_HELP_LINK "" )
# SET( CPACK_NSIS_URL_INFO_ABOUT "" )
# SET( CPACK_NSIS_CONTACT "" )
# SET( CPACK_NSIS_CREATE_ICONS_EXTRA "" )
# SET( CPACK_NSIS_DELETE_ICONS_EXTRA "" )
# SET( CPACK_NSIS_MENU_LINKS "" )
# SET( CPACK_NSIS_MUI_FINISHPAGE_RUN "" )
#ENDIF()
# currently OSX is not supported
#IF( ${APPLE} )
# SET( CPACK_GNERATOR "MACOSX_BUNDLE;" )
# SET( CPACK_PACKAGE_FILE_NAME "" )
# SET( CPACK_PACKAGE_ICON "" )
# SET( CPACK_BUNDLE_NAME "" )
# SET( CPACK_BUNDLE_ICON "" )
# SET( CPACK_BUNDLE_PLIST "" )
# SET( CPACK_BUNDLE_STARTUP_COMMAND "" )
#ENDIF()
#
# doxygen documentation
#
CONFIGURE_FILE( doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile )
ADD_CUSTOM_TARGET( doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile )
SET_PROPERTY( DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CKEAN_FILES doc )
GET_TARGET_PROPERTY( DOC_TARGET doc TYPE )
IF( NOT DOC_TARGET )
ADD_CUSTOM_TARGET( doc )
ENDIF()
ADD_DEPENDENCIES( doc doxygen )
SET( DOC_PATH "share/doc/${CPACK_PACKAGE_NAME}-${VERSION}" )
INSTALL( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION DOC_PATH )