I have a custom target with .cpp and .h source files. As normal, those files include other header files. I'd like to add a directory for header files to be looked from.
This might sounds easy so far, but here's the twist. I'm using a custom target and custom commands to compile and link the program. The actual compiler needs another type of project file, which is not compatible with CMake.
If I try to add include directories to my current target, I'm greeted with the following error:
target_include_directories called with non-compliant target type.
The reason I think that this might be possible is that you can add header file lookup paths in the Visual Studio project I'm creating from CMake. I would not like to do this, because it's not persistent and everyone on my team would have to do it too. And what's worse, I would have to explain it to them ... (shudders)
EDIT:
To answer comments, I'm generating Visual Studio 2017 project files. My custom target command is just:
add_custom_target(APP
DEPENDS ${APP_DEPENDENCIES}
SOURCES ${APP_DEPENDENCIES}
)
and my custom command is:
add_custom_command(
OUTPUT "${LIB_COMPILE_DIR}/libAPP.a"
DEPENDS ${LIB_COMPILE_SRCS}
COMMAND gbuild -top ${LIB_COMPILE_DIR}/App.gpj
WORKING_DIRECTORY ${LIB_COMPILE_DIR}
)
I'm aware that CMake has a generator for GHS MULTI but it is quite experimental and doesn't work in my case.