twogood / unshield

Tool and library to extract CAB files from InstallShield installers
MIT License
332 stars 71 forks source link

cmake: Add install export set #164

Closed bwrsandman closed 7 months ago

bwrsandman commented 1 year ago

CMake config sets generate the following files:

An export set allows CMake users to more easily link with a cmake library which unshield now is. They can now in CMake do the following:

find_package(unshield REQUIRED COMPONENTS unshield libunshield)
target_link_libraries(example PRIVATE unshield::libunshield)
add_custom_target(unshield-version COMMAND unshield::unshield -V)

Using add_custom_target(... unshield::unshield...) can be used as a dependency for another target to generate (extract) files

Also added artifact upload to the cmake tests.

Resulting tree

install
├── bin
│   └── unshield
├── include
│   └── libunshield.h
├── lib
│   ├── cmake
│   │   └── unshield
│   │       ├── unshieldConfig.cmake
│   │       └── unshieldConfig-release.cmake
│   ├── libunshield.so -> libunshield.so.0
│   ├── libunshield.so.0 -> libunshield.so.0.0.0
│   ├── libunshield.so.0.0.0
│   └── pkgconfig
│       └── libunshield.pc
└── share
    └── man
        └── man1
            └── unshield.1

ref: https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html#exporting-targets

bwrsandman commented 1 year ago

Side note, the version is set in https://github.com/twogood/unshield/blob/550ddfe7344c068f9e77a49710bac4f03166b838/lib/CMakeLists.txt#L33

kratz00 commented 7 months ago

@bwrsandman Please resolve the conflicts and update your branch, I will have a look then, thanks in advance.

bwrsandman commented 7 months ago

Here are the artifacts that the action generates. image

bwrsandman commented 7 months ago

Switched to UPPER

twogood commented 7 months ago

Thank you @bwrsandman and @kratz00 !