Add include_directories in Visual Studio 19

I am trying to include the header files of an external package in my library. Before VS19 + geant4.11 it was simply adding
include_directories(${PCRE_INCLUDE_DIR})
in the CMakeLists.txt of my new library
But this does not seem to work anymore: I tried target_include_directories (and many other things…) but it does not work because I am just building a library not a target. I am copying here my CMakeLists.txt.
Thanks

add_definitions(-DG4ICOMS_ALLOC_EXPORT)
add_definitions(-D_WIN32)
include_directories( ${PCRE_INCLUDE_DIR} )

(I checked PCRE_INCLUDE_DIR is properly defined)

geant4_global_library_target(NAME MyNewLibrary COMPONENTS sources.cmake)

Is this a library within Geant4, or for a separate project? The geant4_global_library_target CMake command is only for use within the toolkit itself.

Otherwise, if this for a new toolkit library, could you post the sources.cmake file used by the command please?

Many thanks, Ben. I looked at the sources.cmake and added
geant4_module_include_directories(GamosCore_GamosUtilsUA
PUBLIC $<BUILD_INTERFACE:${MYDIR}>

and it works

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.