how come cmake does not give an error when not specifying FILE name?
I understand that when FILE name not specified, cmake gives it the project's name...by this logic should be mandatory to specify path...
no error:
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/my_math/addition.h
${CMAKE_CURRENT_SOURCE_DIR}/include/my_math/division.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/my_math)
install(TARGETS my_math EXPORT my_export DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/my_math)
install(EXPORT my_export DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/my_math)
INTERFACE_INCLUDE_DIRECTORIES error:
install(TARGETS my_math EXPORT my_export DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/my_math)
install(EXPORT my_export
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/my_math
FILE my_math-config.cmake)
complete error message:
CMake Error in my_math/CMakeLists.txt:
Target "my_math" INTERFACE_INCLUDE_DIRECTORIES property contains path:
"/home/alon/cmake/sandbox/Install/my_math/include"
which is prefixed in the source directory.
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
question from:
https://stackoverflow.com/questions/65934889/why-interface-include-directories-error-appears-when-adding-file-name-cmake 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…