Skip to content

Commit 597b17e

Browse files
authored
[CMake] Fix build from empty CMAKE_LIBRARY_OUTPUT_DIRECTORY (#8810)
If building from root `CMakeLists.txt`, we will have an empty `CMAKE_LIBRARY_OUTPUT_DIRECTORY`, then this will try to create `/plugins` and see permission failures.
1 parent d8119d5 commit 597b17e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/Plugins/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,16 @@ foreach( plugin ${TRITON_PLUGIN_PASSES} )
3535
"$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>"
3636
)
3737

38-
set_target_properties(${plugin} PROPERTIES
38+
# CMAKE_LIBRARY_OUTPUT_DIRECTORY is only set during the Python
39+
# build. It is empty if building directly from the root
40+
# CMakeLists.txt file. Therefore if not building from Python just
41+
# use the default CMake shared lib path otherwise this causes a hard
42+
# build error
43+
if(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
44+
set_target_properties(${plugin} PROPERTIES
3945
LIBRARY_OUTPUT_DIRECTORY
4046
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../plugins")
47+
endif(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
4148

4249
target_compile_options(${plugin} PRIVATE -fvisibility=hidden)
4350
endforeach()

0 commit comments

Comments
 (0)