Skip to content

Commit ff0d450

Browse files
0x6etronical
authored andcommitted
SLINT_TARGET_SOURCES sets target_include_directories using a generator expression
This ensures that the binary directory path isn't exposed in the target's `INTERFACE_INCLUDE_DIRECTORIES`. This prevents CMake errors when we `install` a target with generated Slint sources in the include directory: ``` [cmake] CMake Error in slint/cpp/CMakeLists.txt: [cmake] Target "slint-demo-cpp" INTERFACE_INCLUDE_DIRECTORIES property contains [cmake] path: [cmake] [cmake] "/path/to/build/slint/cpp" [cmake] [cmake] which is prefixed in the build directory. ```
1 parent 68b4627 commit ff0d450

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

api/cpp/cmake/SlintMacro.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,5 @@ function(SLINT_TARGET_SOURCES target)
9191

9292
target_sources(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${_SLINT_BASE_NAME}.h ${cpp_files})
9393
endforeach()
94-
target_include_directories(${target} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
94+
target_include_directories(${target} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
9595
endfunction()

0 commit comments

Comments
 (0)