goToMain / libosdp

Implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol); provides a C library with support for C++, Rust and Python3
https://libosdp.sidcha.dev
Apache License 2.0
130 stars 69 forks source link

Fix cmake package file #108

Closed rm5248 closed 1 year ago

rm5248 commented 1 year ago

Fix for #107

When using libosdp, you can now link in cmake with:

find_package(LibOSDP)
target_link_libraries( target-name PRIVATE libosdp::osdp)
sidcha commented 1 year ago

@rm5248 thanks for the PR, haven't taken a close look at it yet. Can you take a look at the CI failures? pytest (which use pyosdp) seems unhappy.

Also on my Mac I find that trying to link to MbedTLS does not work.

-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build type unspecified, setting to 'Debug'
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
-- Found MbedTLS: /opt/homebrew/include
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Failed to find sphinx-build executable (missing: SPHINX_EXECUTABLE)
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Found Python3: /opt/homebrew/Frameworks/Python.framework/Versions/3.11/bin/python3.11 (found version "3.11.2") found components: Interpreter
-- Configuring done
CMake Error at src/CMakeLists.txt:134 (target_link_libraries):
  Target "osdp" links to:

    Mbedtls::mbedcrypto

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
rm5248 commented 1 year ago

@rm5248 thanks for the PR, haven't taken a close look at it yet. Can you take a look at the CI failures? pytest (which use pyosdp) seems unhappy.

This is very weird - this did work for me before, but maybe I had something left over from an old build? I can reproduce it on my end, but I can't figure out why it's broken. All of the .o files do seem to exist.

Also on my Mac I find that trying to link to MbedTLS does not work.

Looks like a typo, should be simple enough to change Mbedtls::mbedcrypto to MbedTLS::mbedcrypto.

sidcha commented 1 year ago

In essence, with this fixup over your changes, things work mostly for me.

sidcha commented 1 year ago

Also, Instead of merging your branch to goToMain:master from UI, you could run

git pull https://github.com/goToMain/libosdp.git master --rebase
git push origin fix-cmake-package-file -f

To avoid one extra merge commit.