diff --git a/cmake/Modules/FindLuaBuild/LuaVanilla.cmake b/cmake/Modules/FindLuaBuild/LuaVanilla.cmake index fbb08f20..fef51896 100644 --- a/cmake/Modules/FindLuaBuild/LuaVanilla.cmake +++ b/cmake/Modules/FindLuaBuild/LuaVanilla.cmake @@ -335,10 +335,10 @@ target_compile_options(${liblua} PRIVATE ${LUA_VANILLA_LUALIB_COMPILER_OPTIONS}) add_dependencies(${liblua} LUA_VANILLA) if (CMAKE_DL_LIBS) - target_link_libraries(${liblua} ${CMAKE_DL_LIBS}) + target_link_libraries(${liblua} PRIVATE ${CMAKE_DL_LIBS}) endif() if (UNIX) - target_link_libraries(${liblua} m) + target_link_libraries(${liblua} PRIVATE m) endif() # we don't really need this section... @@ -372,12 +372,12 @@ else() endif() target_compile_options(${luainterpreter} PRIVATE ${LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS}) -target_link_libraries(${luainterpreter} ${liblua}) +target_link_libraries(${luainterpreter} PRIVATE ${liblua}) if (CMAKE_DL_LIBS) - target_link_libraries(${luainterpreter} ${CMAKE_DL_LIBS}) + target_link_libraries(${luainterpreter} PRIVATE ${CMAKE_DL_LIBS}) endif() if (UNIX) - target_link_libraries(${luainterpreter} m readline) + target_link_libraries(${luainterpreter} PRIVATE m readline) endif() # LuaC Compiler @@ -414,13 +414,13 @@ else() target_compile_definitions(${luacompiler} PRIVATE LUA_USE_LINUX) endif() -target_link_libraries(${luacompiler} ${liblua}) +target_link_libraries(${luacompiler} PRIVATE ${liblua}) if (CMAKE_DL_LIBS) - target_link_libraries(${luacompiler} ${CMAKE_DL_LIBS}) + target_link_libraries(${luacompiler} PRIVATE ${CMAKE_DL_LIBS}) endif() if (UNIX) # TODO: make readline optional? - target_link_libraries(${luacompiler} m readline) + target_link_libraries(${luacompiler} PRIVATE m readline) endif() # set externally-visible target indicator diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index e63839d4..859bed51 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -41,8 +41,7 @@ add_library(sol2_assert INTERFACE) add_library(sol2::assert ALIAS sol2_assert) set_target_properties(sol2_assert PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include" - EXPORT_NAME sol2::assert) + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include") if (SOL2_CI) target_compile_definitions(sol2_assert PUBLIC SOL2_CI) @@ -93,7 +92,7 @@ function (MAKE_EXAMPLE example_source_file example_suffix target_sol) PRIVATE ${target_sol} ${LUA_LIBRARIES} sol2::assert) if(CMAKE_DL_LIBS) - target_link_libraries(${example_name} ${CMAKE_DL_LIBS}) + target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS}) endif() if (SOL2_TESTS_EXAMPLES) diff --git a/tests/runtime_tests/CMakeLists.txt b/tests/runtime_tests/CMakeLists.txt index 56e7a119..c6bbfc15 100644 --- a/tests/runtime_tests/CMakeLists.txt +++ b/tests/runtime_tests/CMakeLists.txt @@ -79,7 +79,7 @@ function(CREATE_TEST test_target_name test_name target_sol) if (CMAKE_DL_LIBS) target_link_libraries(${test_target_name} - ${CMAKE_DL_LIBS}) + PRIVATE ${CMAKE_DL_LIBS}) endif() add_test(NAME ${test_name} COMMAND ${test_target_name})