compile and link third-party amalgamation as a static lib instead of object files and fix clang warnings in cryptopp

This commit is contained in:
Thomas Fussell 2017-01-02 17:41:39 -05:00
parent 913507dda6
commit 42c9233ad9
3 changed files with 15 additions and 4 deletions

View File

@ -116,7 +116,7 @@ set(XLNT_SOURCES ${CELL_SOURCES} ${CHARTS_SOURCES} ${CHARTSHEET_SOURCES}
${WORKSHEET_SOURCES} ${DETAIL_SOURCES})
if(NOT STATIC)
add_library(xlnt SHARED ${XLNT_HEADERS} ${XLNT_SOURCES} $<TARGET_OBJECTS:xlnt.third-party>)
add_library(xlnt SHARED ${XLNT_HEADERS} ${XLNT_SOURCES})
target_compile_definitions(xlnt PRIVATE XLNT_SHARED=1)
if(MSVC)
@ -146,7 +146,7 @@ if(NOT STATIC)
)
endif()
else()
add_library(xlnt STATIC ${XLNT_HEADERS} ${XLNT_SOURCES} $<TARGET_OBJECTS:xlnt.third-party>)
add_library(xlnt STATIC ${XLNT_HEADERS} ${XLNT_SOURCES} xlnt.third-party)
target_compile_definitions(xlnt PUBLIC XLNT_STATIC=1)
if(MSVC)
@ -164,6 +164,7 @@ target_compile_definitions(${PROJECT_NAME}
PRIVATE LIBSTUDXML_STATIC_LIB=1
PRIVATE NO_OS_DEPENDENCE=1
PRIVATE CRYPTOPP_DISABLE_ASM=1)
target_link_libraries(${PROJECT_NAME} xlnt.third-party)
if(MSVC)
set_target_properties(xlnt PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\" /wd\"4068\" /MP")

View File

@ -48,8 +48,9 @@ if(COVERAGE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov --coverage")
endif()
add_executable(${PROJECT_NAME} ${TEST_HELPERS} ${TESTS} ${RUNNER} $<TARGET_OBJECTS:xlnt.third-party> ${XLNT_ZIP})
add_executable(${PROJECT_NAME} ${TEST_HELPERS} ${TESTS} ${RUNNER} ${XLNT_ZIP})
target_compile_definitions(${PROJECT_NAME} PRIVATE LIBSTUDXML_STATIC_LIB=1)
target_link_libraries(${PROJECT_NAME} xlnt.third-party)
source_group(helpers FILES ${TEST_HELPERS})
source_group(xlnt\\detail FILES ${XLNT_ZIP})

View File

@ -93,13 +93,22 @@ if(MINGW OR WIN32)
list(APPEND CRYPTOPP ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/winpipes.cpp)
endif()
if(NOT MSVC)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/basecode.cpp PROPERTIES
COMPILE_FLAGS "-Wno-unused-private-field")
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/rw.cpp PROPERTIES
COMPILE_FLAGS "-Wno-unused-const-variable")
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/filters.cpp PROPERTIES
COMPILE_FLAGS "-Wno-reorder")
endif()
if(NOT MSVC)
set_source_files_properties(${ZLIB} PROPERTIES COMPILE_FLAGS "-Wno-implicit-function-declaration")
else()
set_source_files_properties(${ZLIB} PROPERTIES COMPILE_FLAGS "/wd\"4018\"")
endif()
add_library(xlnt.third-party OBJECT
add_library(xlnt.third-party STATIC
${LIBSTUDXML}
${GENX}
${EXPAT}