Browse Source

- fixed cmake warnings

development
Andreas Romeyke 8 months ago
parent
commit
545e20103a
1 changed files with 37 additions and 37 deletions
  1. +37
    -37
      src/CMakeLists.txt

+ 37
- 37
src/CMakeLists.txt View File

@ -40,7 +40,7 @@ add_definitions(-DREPO_REVISION="${REPO_REVISION}")
check_ipo_supported(RESULT LTO_IS_SUPPORTED OUTPUT LTO_CHECK_ERROR)
if (LTO_IS_SUPPORTED)
message(STATUS "IPO / LTO enabled")
SET(INTERPROCEDURAL_OPTIMIZATIONS TRUE)
set(INTERPROCEDURAL_OPTIMIZATIONS TRUE)
else()
message(STATUS "IPO / LTO unsupported: <${LTO_CHECK_ERROR}>")
endif()
@ -63,21 +63,21 @@ endif()
if(WIN32)
add_definitions(-D__WIN32__=1)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
SET(BUILD_SHARED_LIBRARIES OFF)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_SHARED_LIBRARIES OFF)
# needed to increase default stack, because Win7 has only 1MB
SET(CMAKE_EXE_LINKER_FLAGS "-static -Wl,--stack,20000000")
set(CMAKE_EXE_LINKER_FLAGS "-static -Wl,--stack,20000000")
add_definitions(-DPCRE_STATIC)
add_definitions(-D_POSIX_C_SOURCE=200809L)
# FIXME: needed for MingW only
add_definitions(-D_GNU_SOURCE=1)
endif(WIN32)
endif()
if(STATIC)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
SET(BUILD_SHARED_LIBRARIES OFF)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_SHARED_LIBRARIES OFF)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
add_definitions(-DPCRE_STATIC)
endif(STATIC)
endif()
add_executable(checkit_tiff checkit_tiff.c ${checkit_tiff_SOURCES})
add_executable(checkit_check_config checkit_check_config.c ${checkit_tiff_SOURCES})
@ -88,33 +88,33 @@ set(CMAKE_EXTRA_INCLUDE_FILES tiff.h)
#libpcre
#find_package(LIBPCRE REQUIRED)
FIND_PATH(PCRE_INCLUDE_DIR NAMES pcre.h)
FIND_LIBRARY(PCRE_LIBRARY NAMES pcre)
INCLUDE(FindPackageHandleStandardArgs)
find_path(PCRE_INCLUDE_DIR NAMES pcre.h)
find_library(PCRE_LIBRARY NAMES pcre)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR)
if (PCRE_FOUND)
SET(PCRE_LIBRARIES ${PCRE_LIBRARY})
set(PCRE_LIBRARIES ${PCRE_LIBRARY})
if (STATIC)
SET(PCRE_LIBRARIES ${PCRE_LIBRARIES} -lpthread)
endif(STATIC)
SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR})
else(PCRE_FOUND)
MESSAGE(FATAL_ERROR "No PCRE library found, add $PCRE_INCLUDE_DIR manually")
endif(PCRE_FOUND)
set(PCRE_LIBRARIES ${PCRE_LIBRARIES} -lpthread)
endif()
set(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
include_directories(${PCRE_INCLUDE_DIR})
else()
message(FATAL_ERROR "No PCRE library found, add $PCRE_INCLUDE_DIR manually")
endif()
#find mmap
CHECK_FUNCTION_EXISTS(mmap _HAVE_MMAP)
CHECK_FUNCTION_EXISTS(munmap _HAVE_MUNMAP)
IF(_HAVE_MMAP AND _HAVE_MUNMAP)
MESSAGE(INFO "mmap found")
SET(_HAVE__MMAP 1)
ENDIF()
if(_HAVE_MMAP AND _HAVE_MUNMAP)
message(INFO "mmap found")
set(_HAVE__MMAP 1)
endif()
TARGET_LINK_LIBRARIES(checkit_tiff ${PCRE_LIBRARIES})
TARGET_LINK_LIBRARIES(checkit_check_config ${PCRE_LIBRARIES})
TARGET_LINK_LIBRARIES(checkit_tiff_risk)
target_link_libraries(checkit_tiff ${PCRE_LIBRARIES})
target_link_libraries(checkit_check_config ${PCRE_LIBRARIES})
target_link_libraries(checkit_tiff_risk)
install( TARGETS checkit_tiff
RUNTIME DESTINATION bin
@ -130,30 +130,30 @@ install(DIRECTORY
file( GLOB README_FILES "../README*" "../FAQ" "../LICENSE" "../TODO" "../BUGS")
install(FILES ${README_FILES} DESTINATION share/checkit_tiff/)
INCLUDE(FindPerl)
include(FindPerl)
if (PERL_FOUND)
enable_testing()
SET(T_DIR ${PROJECT_SOURCE_DIR}/../t )
set(T_DIR ${PROJECT_SOURCE_DIR}/../t )
add_test(NAME grammar COMMAND ${PERL_EXECUTABLE} -I ${T_DIR} test_grammar.t WORKING_DIRECTORY ${T_DIR} )
add_test(NAME config COMMAND ${PERL_EXECUTABLE} -I ${T_DIR} test_config_examples.t WORKING_DIRECTORY ${T_DIR} )
add_test(NAME validfiles COMMAND ${PERL_EXECUTABLE} -I ${T_DIR} test_should_pass.t WORKING_DIRECTORY ${T_DIR} )
add_test(NAME invalidfiles COMMAND ${PERL_EXECUTABLE} -I ${T_DIR} test_should_fail.t WORKING_DIRECTORY ${T_DIR} )
else(PERL_FOUND)
MESSAGE(WARN "for testsuite an installed Perl is needed")
else()
message(WARN "for testsuite an installed Perl is needed")
endif()
# CPACK definitions
INCLUDE(InstallRequiredSystemLibraries)
include(InstallRequiredSystemLibraries)
set (CPACK_PACKAGE_VENDOR "Andreas Romeyke")
string(REGEX REPLACE "^v([0-9]+).*" "\\1" MAJOR_VERSION ${BUILD_TAG})
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+)\\.[0-9]+[^0-9].*" "\\1" MINOR_VERSION ${BUILD_TAG})
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+)[^0-9].*" "\\1" PATCH_VERSION ${BUILD_TAG})
MESSAGE( "BUILDTAG (after) : '${BUILD_TAG}'")
MESSAGE( "MAJOR VERSION: ${MAJOR_VERSION}")
MESSAGE( "MINOR VERSION: ${MINOR_VERSION}")
MESSAGE( "PATCH VERSION: ${PATCH_VERSION}")
message( "BUILDTAG (after) : '${BUILD_TAG}'")
message( "MAJOR VERSION: ${MAJOR_VERSION}")
message( "MINOR VERSION: ${MINOR_VERSION}")
message( "PATCH VERSION: ${PATCH_VERSION}")
set (CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
set (CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION})
set (CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION})
@ -175,4 +175,4 @@ corresponding values more fine granulary. The rulesets are human readable and
could be adapted to own needs.")
set(CPACK_DEBIAN_PACKAGE_SECTION "misc")
set(CPACK_DEBIAN_COMPRESSION_TYPE "xz")
INCLUDE(CPack)
include(CPack)

Loading…
Cancel
Save