Unverified Commit deaaefa5 authored by Miloš Komarčević's avatar Miloš Komarčević Committed by GitHub
Browse files

Improve cmake for mingw (#19)


Signed-off-by: default avatarMiloš Komarčević <miloskomarcevic@aim.com>
parent a4139006
...@@ -7,7 +7,7 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ...@@ -7,7 +7,7 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD 99)
set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
enable_testing() include(CTest)
include(TestBigEndian) include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN) test_big_endian(WORDS_BIGENDIAN)
...@@ -39,7 +39,9 @@ configure_file( ...@@ -39,7 +39,9 @@ configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/config.h") "${CMAKE_CURRENT_BINARY_DIR}/config.h")
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(tests) if(BUILD_TESTING)
add_subdirectory(tests)
endif()
option(AEC_FUZZING "Enable build of fuzzing target" OFF) option(AEC_FUZZING "Enable build of fuzzing target" OFF)
if(AEC_FUZZING) if(AEC_FUZZING)
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
find_path(libaec_INCLUDE_DIR NAMES libaec.h DOC "AEC include directory") find_path(libaec_INCLUDE_DIR NAMES libaec.h DOC "AEC include directory")
find_path(SZIP_INCLUDE_DIR NAMES szlib.h DOC "SZIP include directory") find_path(SZIP_INCLUDE_DIR NAMES szlib.h DOC "SZIP include directory")
if (libaec_USE_STATIC_LIBS) if (libaec_USE_STATIC_LIBS)
if (WIN32) if (MSVC)
find_library(libaec_LIBRARY NAMES aec_static.lib DOC "AEC library") find_library(libaec_LIBRARY NAMES aec_static.lib DOC "AEC library")
find_library(SZIP_LIBRARY NAMES szip_static.lib DOC "SZIP compatible version of the AEC library") find_library(SZIP_LIBRARY NAMES szip_static.lib DOC "SZIP compatible version of the AEC library")
else () else ()
...@@ -35,13 +35,8 @@ if (libaec_USE_STATIC_LIBS) ...@@ -35,13 +35,8 @@ if (libaec_USE_STATIC_LIBS)
find_library(SZIP_LIBRARY NAMES libsz.a DOC "SZIP compatible version of the AEC library") find_library(SZIP_LIBRARY NAMES libsz.a DOC "SZIP compatible version of the AEC library")
endif () endif ()
else () else ()
if (WIN32) find_library(libaec_LIBRARY NAMES aec DOC "AEC library")
find_library(libaec_LIBRARY NAMES aec.lib DOC "AEC library") find_library(SZIP_LIBRARY NAMES sz szip DOC "SZIP compatible version of the AEC library")
find_library(SZIP_LIBRARY NAMES szip.lib DOC "SZIP compatible version of the AEC library")
else ()
find_library(libaec_LIBRARY NAMES libaec.so DOC "AEC library")
find_library(SZIP_LIBRARY NAMES libsz.so DOC "SZIP compatible version of the AEC library")
endif ()
endif () endif ()
# Check version here # Check version here
......
...@@ -15,7 +15,7 @@ add_library(aec_static STATIC "$<TARGET_OBJECTS:aec>") ...@@ -15,7 +15,7 @@ add_library(aec_static STATIC "$<TARGET_OBJECTS:aec>")
target_link_libraries(aec_static PUBLIC aec) target_link_libraries(aec_static PUBLIC aec)
set_target_properties(aec_static set_target_properties(aec_static
PROPERTIES PROPERTIES
OUTPUT_NAME $<IF:$<BOOL:${WIN32}>,aec_static,aec>) OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,aec_static,aec>)
add_library(aec_shared SHARED "$<TARGET_OBJECTS:aec>") add_library(aec_shared SHARED "$<TARGET_OBJECTS:aec>")
target_link_libraries(aec_shared PUBLIC aec) target_link_libraries(aec_shared PUBLIC aec)
...@@ -34,7 +34,7 @@ target_link_libraries(sz PUBLIC aec) ...@@ -34,7 +34,7 @@ target_link_libraries(sz PUBLIC aec)
add_library(sz_static STATIC "$<TARGET_OBJECTS:sz>" "$<TARGET_OBJECTS:aec>") add_library(sz_static STATIC "$<TARGET_OBJECTS:sz>" "$<TARGET_OBJECTS:aec>")
set_target_properties(sz_static set_target_properties(sz_static
PROPERTIES PROPERTIES
OUTPUT_NAME $<IF:$<BOOL:${WIN32}>,szip_static,sz>) OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,szip_static,sz>)
target_link_libraries(sz_static PUBLIC sz) target_link_libraries(sz_static PUBLIC sz)
add_library(sz_shared SHARED "$<TARGET_OBJECTS:sz>" "$<TARGET_OBJECTS:aec>") add_library(sz_shared SHARED "$<TARGET_OBJECTS:sz>" "$<TARGET_OBJECTS:aec>")
...@@ -43,7 +43,7 @@ set_target_properties(sz_shared ...@@ -43,7 +43,7 @@ set_target_properties(sz_shared
PROPERTIES PROPERTIES
VERSION 2.0.1 VERSION 2.0.1
SOVERSION 2 SOVERSION 2
OUTPUT_NAME $<IF:$<BOOL:${WIN32}>,szip,sz> OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,szip,sz>
PUBLIC_HEADER ../include/szlib.h) PUBLIC_HEADER ../include/szlib.h)
# Simple client for testing and benchmarking. # Simple client for testing and benchmarking.
...@@ -70,7 +70,9 @@ if(UNIX) ...@@ -70,7 +70,9 @@ if(UNIX)
${CMAKE_CURRENT_SOURCE_DIR}/../data/typical.rz ${CMAKE_CURRENT_SOURCE_DIR}/../data/typical.rz
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bdec.sh COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bdec.sh
DEPENDS aec_client utime) DEPENDS aec_client utime)
endif()
if(UNIX OR MINGW)
# Install manpage # Install manpage
install( install(
FILES aec.1 FILES aec.1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment