Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

why INTERFACE_INCLUDE_DIRECTORIES error appears when adding FILE name. Cmake

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...