diff options
Diffstat (limited to 'Tests')
6 files changed, 81 insertions, 28 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index ea64646..fe8f2cc 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -145,8 +145,7 @@ if(BUILD_TESTING) set(CPACK_BINARY_RPM OFF) endif() - # Look for rpmbuild to use for tests. - # The tool does not work with spaces in the path. + # Look for dpkg to use for tests. find_program(DPKG_EXECUTABLE NAMES dpkg) if(DPKG_EXECUTABLE) @@ -155,6 +154,15 @@ if(BUILD_TESTING) set(CPACK_BINARY_DEB OFF) endif() + # Look for NuGet to use for tests. + find_program(NUGET_EXECUTABLE NAMES NuGet nuget) + + if(NUGET_EXECUTABLE) + set(CPACK_BINARY_NUGET ON) + else() + set(CPACK_BINARY_NUGET OFF) + endif() + #--------------------------------------------------------------------------- # Add tests below here. @@ -1033,6 +1041,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(CPACK_BINARY_DEB) list(APPEND ACTIVE_CPACK_GENERATORS DEB) endif() + # Check whether if NuGet command is found + # before adding NuGet tests + if(CPACK_BINARY_NUGET) + list(APPEND ACTIVE_CPACK_GENERATORS NUGET) + set(CPACK_GENERATOR_STRING_NUGET NuGet) + endif() # ACTIVE_CPACK_GENERATORS variable # now contains the list of 'active generators' @@ -1052,7 +1066,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release list(APPEND CWAYLST "IgnoreGroup") list(APPEND CWAYLST "AllInOne") foreach(CPackGen IN LISTS ACTIVE_CPACK_GENERATORS) - set(CPackRun_CPackGen "-DCPackGen=${CPackGen}") + if(NOT DEFINED CPACK_GENERATOR_STRING_${CPackGen}) + set(CPACK_GENERATOR_STRING_${CPackGen} ${CPackGen}) + endif() + set(CPackRun_CPackGen "-DCPackGen=${CPACK_GENERATOR_STRING_${CPackGen}}") foreach(CPackComponentWay ${CWAYLST}) set(CPackRun_CPackComponentWay "-DCPackComponentWay=${CPackComponentWay}") add_test(CPackComponentsForAll-${CPackGen}-${CPackComponentWay} @@ -1063,7 +1080,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ${build_generator_args} --build-project CPackComponentsForAll --build-options ${build_options} - -DCPACK_GENERATOR:STRING=${CPackGen} + -DCPACK_GENERATOR:STRING=${CPACK_GENERATOR_STRING_${CPackGen}} -DCPACK_BINARY_${CPackGen}:BOOL=ON ${CPackRun_CPackComponentWay} ${CPackComponentsForAll_BUILD_OPTIONS} diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index 3440843..f2e4fcd 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -168,6 +168,18 @@ set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}" # set CPACK_DEBIAN_FILE_NAME to use default package name format set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") +# set some tags for NuGet packages +# 1. all in one pacakge +set(CPACK_NUGET_PACKAGE_TAGS "nuget" "unit" "test" "all-in-one") +# 2. per component packages +set(CPACK_NUGET_APPLICATIONS_PACKAGE_TAGS "nuget" "unit" "test" "applications") +set(CPACK_NUGET_LIBRARIES_PACKAGE_TAGS "nuget" "unit" "test" "libraries") +set(CPACK_NUGET_HEADERS_PACKAGE_TAGS "nuget" "unit" "test" "headers") +set(CPACK_NUGET_UNSPECIFIED_PACKAGE_TAGS "nuget" "unit" "test" "uNsP3c1FiEd") +# 3. per group packages +set(CPACK_NUGET_RUNTIME_PACKAGE_TAGS "nuget" "unit" "test" "run-time") +set(CPACK_NUGET_DEVELOPMENT_PACKAGE_TAGS "nuget" "unit" "test" "development") + # We may use the CPack specific config file in order # to tailor CPack behavior on a CPack generator specific way # (Behavior would be different for RPM or TGZ or DEB ...) diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-AllInOne.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-AllInOne.cmake.in index 0bfbf14..1b9e658 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-AllInOne.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-AllInOne.cmake.in @@ -13,6 +13,10 @@ if(CPACK_GENERATOR MATCHES "DEB") set(CPACK_DEB_COMPONENT_INSTALL "ON") endif() +if(CPACK_GENERATOR MATCHES "NuGet") + set(CPACK_NUGET_COMPONENT_INSTALL "ON") +endif() + # # Choose grouping way # diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index 0ffe44d..a6f6ea9 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -52,6 +52,10 @@ if(CPACK_GENERATOR MATCHES "DEB") set(CPACK_DEB_COMPONENT_INSTALL "ON") endif() +if(CPACK_GENERATOR MATCHES "NuGet") + set(CPACK_NUGET_COMPONENT_INSTALL "ON") +endif() + # # Choose grouping way # diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in index ac65dc9..d41225d 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-OnePackPerGroup.cmake.in @@ -18,6 +18,10 @@ if(CPACK_GENERATOR MATCHES "DragNDrop") set(CPACK_COMPONENTS_GROUPING "ONE_PER_GROUP") endif() +if(CPACK_GENERATOR MATCHES "NuGet") + set(CPACK_NUGET_COMPONENT_INSTALL "ON") +endif() + # # Choose grouping way # diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 2c3a849..253d128 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -38,57 +38,69 @@ set(config_verbose ) if(CPackGen MATCHES "ZIP") set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.zip") - if (${CPackComponentWay} STREQUAL "default") + if(${CPackComponentWay} STREQUAL "default") set(expected_count 1) - elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup") + elseif(${CPackComponentWay} STREQUAL "OnePackPerGroup") set(expected_count 3) - elseif (${CPackComponentWay} STREQUAL "IgnoreGroup") + elseif(${CPackComponentWay} STREQUAL "IgnoreGroup") set(expected_count 4) - elseif (${CPackComponentWay} STREQUAL "AllInOne") + elseif(${CPackComponentWay} STREQUAL "AllInOne") set(expected_count 1) - endif () -elseif (CPackGen MATCHES "RPM") + endif() +elseif(CPackGen MATCHES "RPM") set(config_verbose -D "CPACK_RPM_PACKAGE_DEBUG=1") set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.rpm") - if (${CPackComponentWay} STREQUAL "default") + if(${CPackComponentWay} STREQUAL "default") set(expected_count 1) - elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup") + elseif(${CPackComponentWay} STREQUAL "OnePackPerGroup") set(expected_count 3) - elseif (${CPackComponentWay} STREQUAL "IgnoreGroup") + elseif(${CPackComponentWay} STREQUAL "IgnoreGroup") set(expected_count 4) - elseif (${CPackComponentWay} STREQUAL "AllInOne") + elseif(${CPackComponentWay} STREQUAL "AllInOne") set(expected_count 1) - endif () -elseif (CPackGen MATCHES "DEB") + endif() +elseif(CPackGen MATCHES "DEB") set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/mylib*_1.0.2_*.deb") - if (${CPackComponentWay} STREQUAL "default") + if(${CPackComponentWay} STREQUAL "default") set(expected_count 1) - elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup") + elseif(${CPackComponentWay} STREQUAL "OnePackPerGroup") set(expected_count 3) - elseif (${CPackComponentWay} STREQUAL "IgnoreGroup") + elseif(${CPackComponentWay} STREQUAL "IgnoreGroup") set(expected_count 4) - elseif (${CPackComponentWay} STREQUAL "AllInOne") + elseif(${CPackComponentWay} STREQUAL "AllInOne") set(expected_count 1) - endif () + endif() +elseif(CPackGen MATCHES "NuGet") + set(config_verbose -D "CPACK_NUGET_PACKAGE_DEBUG=1") + set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib*1.0.2.nupkg") + if(${CPackComponentWay} STREQUAL "default") + set(expected_count 1) + elseif(${CPackComponentWay} STREQUAL "OnePackPerGroup") + set(expected_count 3) + elseif(${CPackComponentWay} STREQUAL "IgnoreGroup") + set(expected_count 4) + elseif(${CPackComponentWay} STREQUAL "AllInOne") + set(expected_count 1) + endif() endif() if(CPackGen MATCHES "DragNDrop") set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.dmg") - if (${CPackComponentWay} STREQUAL "default") + if(${CPackComponentWay} STREQUAL "default") set(expected_count 1) - elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup") + elseif(${CPackComponentWay} STREQUAL "OnePackPerGroup") set(expected_count 3) - elseif (${CPackComponentWay} STREQUAL "IgnoreGroup") + elseif(${CPackComponentWay} STREQUAL "IgnoreGroup") set(expected_count 4) - elseif (${CPackComponentWay} STREQUAL "AllInOne") + elseif(${CPackComponentWay} STREQUAL "AllInOne") set(expected_count 1) - endif () + endif() endif() # clean-up previously CPack generated files if(expected_file_mask) file(GLOB expected_file "${expected_file_mask}") - if (expected_file) + if(expected_file) file(REMOVE ${expected_file}) endif() endif() @@ -101,7 +113,7 @@ execute_process(COMMAND ${CMAKE_CPACK_COMMAND} ${config_verbose} -G ${CPackGen} ERROR_VARIABLE CPack_error WORKING_DIRECTORY ${CPackComponentsForAll_BINARY_DIR}) -if (CPack_result) +if(CPack_result) message(FATAL_ERROR "error: CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}") else () message(STATUS "CPack_output=${CPack_output}") |