diff --git a/.appveyor.yml b/.appveyor.yml index 9c968d7d..99ebc118 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -15,7 +15,7 @@ init: [] install: [] before_build: - git submodule update --init --recursive -- cmake -H. -Bbuild -G"Visual Studio 14 2015 Win64" -DSHARED=%SHARED% -DSTATIC=%STATIC% -DWITH_TESTS=ON -DWITH_SAMPLES=ON +- cmake -H. -Bbuild -G"Visual Studio 14 2015 Win64" -DSHARED=%SHARED% -DSTATIC=%STATIC% -DWITH_SAMPLES=ON build: project: build\xlnt.sln diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 4d7dd8b5..16126d75 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -2,8 +2,14 @@ project(xlnt.samples) include_directories(${XLNT_INCLUDE_DIR}) +if(SHARED) + set(XLNT_LIB xlnt.shared) +else() + set(XLNT_LIB xlnt.static) +endif() + add_executable(sample-basic ../samples/sample.cpp) -target_link_libraries(sample-basic xlnt.static) +target_link_libraries(sample-basic ${XLNT_LIB}) set_target_properties(sample-basic PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin" @@ -12,7 +18,7 @@ set_target_properties(sample-basic RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin") add_executable(sample-decrypt ../samples/decrypt.cpp) -target_link_libraries(sample-decrypt xlnt.static) +target_link_libraries(sample-decrypt ${XLNT_LIB}) set_target_properties(sample-decrypt PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin" diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 59680ee9..07efd560 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -117,18 +117,18 @@ if(SHARED) VERSION ${PROJECT_VERSION_FULL} SOVERSION ${PROJECT_VERSION} INSTALL_NAME_DIR "${LIB_DEST_DIR}" - RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}" - RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}" - RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}" - RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}" - ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}" - ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}" - ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}" - ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}" - LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}" - LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}" - LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}" - LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}") + RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin" + RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}/bin" + RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin" + RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin" + ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib" + ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}/lib" + ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib" + ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/lib") if(FRAMEWORK) add_custom_command( @@ -158,22 +158,21 @@ if(STATIC) ARCHIVE DESTINATION ${LIB_DEST_DIR} RUNTIME DESTINATION ${BIN_DEST_DIR} ) - set_target_properties( - xlnt.static - PROPERTIES - OUTPUT_NAME xlnt - RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}" - RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}" - RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}" - RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}" - ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}" - ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}" - ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}" - ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}" - LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}" - LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}" - LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}" - LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}") + set_target_properties(xlnt.static + PROPERTIES + OUTPUT_NAME xlnt + RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin" + RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}/bin" + RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin" + RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin" + ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib" + ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}/lib" + ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib" + ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/lib") endif() source_group(xlnt FILES ${ROOT_HEADERS})