fuzziqersoftware / phosg

C++ helpers for some common tasks
18 stars 17 forks source link

Can not be used when not installed in /usr/local #22

Open jaens opened 1 year ago

jaens commented 1 year ago

When installing it into eg. the home directory via cmake --install-prefix=$HOME/opt/pkg/phosg and then using it in another C++ project via eg. -Dphosg_DIR=$HOME/opt/pkg/phosg/lib, the other project will fail to compile due to not finding include files: fatal error: phosg/Encoding.hh: No such file or directory.

I believe this is because this project does not actually export any include files via CMake and only works when they are "coincidentally" installed into /usr/local.

The contents of created phosg-debug.cmake does not seem to generate any relevant "include" directives:

#----------------------------------------------------------------
# Generated CMake target import file for configuration "Debug".
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Import target "phosg" for configuration "Debug"
set_property(TARGET phosg APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(phosg PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
  IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/libphosg.a"
  )

list(APPEND _cmake_import_check_targets phosg )
list(APPEND _cmake_import_check_files_for_phosg "${_IMPORT_PREFIX}/lib/libphosg.a" )

Unfortunately, I'm not much of an expert on CMake so not exactly sure how to properly export header files from a library...