Be consistent with the use of target_link_libraries...

I really dislike CMake
This commit is contained in:
ThePhD 2018-12-27 12:37:56 -05:00
parent 486086ffe0
commit f6e6398f64
No known key found for this signature in database
GPG Key ID: 1509DB1C0F702BFA
3 changed files with 11 additions and 12 deletions

View File

@ -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

View File

@ -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)

View File

@ -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})