mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Rename CMake target from loot to libloot
On Windows using "loot" causes a name collisions with LOOT itself: - for the MSVC project name, it clashes with LOOT's own project, despite the difference in case. This means that you can't build LOOT in Visual Studio when using FetchContent to handle the libloot dependency (running CMake on the CLI works though). - for the PDB file, LOOT has LOOT.pdb and libloot has loot.pdb, which appear to be the same due to file paths being case-insensitive. This makes it more difficult to debug LOOT with the relevant debug info loaded. Renaming the CMake target adds a "lib" prefix to the Visual Studio project name and the artifact filenames: - loot.vcxproj* -> libloot.vcxproj* - loot.dll -> libloot.dll - loot.lib -> libloot.lib - loot.pdb -> libloot.pdb The Linux build artifact filenames are unchanged, as they already had the "lib" prefix.
This commit is contained in:
+23
-21
@@ -155,8 +155,8 @@ else()
|
||||
endif()
|
||||
|
||||
# Build API.
|
||||
add_library(loot ${LIBLOOT_LIBRARY_TYPE} ${LIBLOOT_ALL_SOURCES})
|
||||
target_link_libraries(loot PRIVATE libloot-cpp)
|
||||
add_library(libloot ${LIBLOOT_LIBRARY_TYPE} ${LIBLOOT_ALL_SOURCES})
|
||||
target_link_libraries(libloot PRIVATE libloot-cpp)
|
||||
|
||||
##############################
|
||||
# Set Target-Specific Flags
|
||||
@@ -171,27 +171,29 @@ set(LIBLOOT_COMMON_SYSTEM_INCLUDE_DIRS
|
||||
${ESPLUGIN_INCLUDE_DIRS}
|
||||
${LCI_INCLUDE_DIRS})
|
||||
|
||||
target_include_directories(loot PUBLIC
|
||||
target_include_directories(libloot PUBLIC
|
||||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
||||
target_include_directories(loot PRIVATE ${LIBLOOT_INCLUDE_DIRS})
|
||||
target_include_directories(loot SYSTEM PRIVATE
|
||||
target_include_directories(libloot PRIVATE ${LIBLOOT_INCLUDE_DIRS})
|
||||
target_include_directories(libloot SYSTEM PRIVATE
|
||||
${LIBLOOT_COMMON_SYSTEM_INCLUDE_DIRS})
|
||||
|
||||
set_target_properties(loot PROPERTIES
|
||||
set_target_properties(libloot PROPERTIES
|
||||
CXX_STANDARD 17
|
||||
CXX_STANDARD_REQUIRED ON)
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
# Stop the "lib" prefix being added on Linux, since it's already in the target name.
|
||||
PREFIX "")
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(loot PRIVATE UNICODE _UNICODE LOOT_EXPORT)
|
||||
target_compile_definitions(libloot PRIVATE UNICODE _UNICODE LOOT_EXPORT)
|
||||
|
||||
set(LOOT_LIBS ntdll ws2_32 bcrypt)
|
||||
|
||||
target_link_libraries(loot PRIVATE ${LOOT_LIBS})
|
||||
target_link_libraries(libloot PRIVATE ${LOOT_LIBS})
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(loot PRIVATE
|
||||
target_compile_options(libloot PRIVATE
|
||||
"-Wall"
|
||||
"-Wextra"
|
||||
"-Wpedantic"
|
||||
@@ -217,7 +219,7 @@ endif()
|
||||
|
||||
if(MSVC)
|
||||
# Turn off permissive mode to be more standards-compliant and avoid compiler errors.
|
||||
target_compile_options(loot PRIVATE
|
||||
target_compile_options(libloot PRIVATE
|
||||
"/permissive-"
|
||||
"/W4"
|
||||
"/Wall"
|
||||
@@ -239,7 +241,7 @@ if(MSVC)
|
||||
"/MP"
|
||||
"/sdl"
|
||||
"$<$<CONFIG:Debug>:/RTC1>")
|
||||
target_link_options(loot PRIVATE "/INCREMENTAL:NO" "/LTCG")
|
||||
target_link_options(libloot PRIVATE "/INCREMENTAL:NO" "/LTCG")
|
||||
endif()
|
||||
|
||||
##############################
|
||||
@@ -280,7 +282,7 @@ if(RUN_CLANG_TIDY)
|
||||
set(CLANG_TIDY_LIB
|
||||
clang-tidy "-header-filter=.*" "-checks=${CLANG_TIDY_LIB_CHECKS_JOINED}")
|
||||
|
||||
set_target_properties(loot
|
||||
set_target_properties(libloot
|
||||
PROPERTIES
|
||||
CXX_CLANG_TIDY "${CLANG_TIDY_LIB}")
|
||||
endif()
|
||||
@@ -297,13 +299,13 @@ endif()
|
||||
# Install
|
||||
########################################
|
||||
|
||||
add_library(libloot::loot ALIAS loot)
|
||||
add_library(libloot::libloot ALIAS libloot)
|
||||
|
||||
if(LIBLOOT_BUILD_SHARED)
|
||||
set_property(TARGET loot PROPERTY VERSION ${libloot_VERSION})
|
||||
set_property(TARGET loot PROPERTY SOVERSION ${libloot_VERSION_MAJOR})
|
||||
set_property(TARGET loot PROPERTY INTERFACE_libloot_MAJOR_VERSION ${libloot_VERSION_MAJOR})
|
||||
set_property(TARGET loot APPEND PROPERTY COMPATIBLE_INTERFACE_STRING libloot_MAJOR_VERSION)
|
||||
set_property(TARGET libloot PROPERTY VERSION ${libloot_VERSION})
|
||||
set_property(TARGET libloot PROPERTY SOVERSION ${libloot_VERSION_MAJOR})
|
||||
set_property(TARGET libloot PROPERTY INTERFACE_libloot_MAJOR_VERSION ${libloot_VERSION_MAJOR})
|
||||
set_property(TARGET libloot APPEND PROPERTY COMPATIBLE_INTERFACE_STRING libloot_MAJOR_VERSION)
|
||||
|
||||
configure_package_config_file(
|
||||
${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in
|
||||
@@ -317,7 +319,7 @@ if(LIBLOOT_BUILD_SHARED)
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
|
||||
install(TARGETS loot
|
||||
install(TARGETS libloot
|
||||
EXPORT liblootTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
@@ -328,12 +330,12 @@ if(LIBLOOT_BUILD_SHARED)
|
||||
NAMESPACE libloot::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libloot)
|
||||
|
||||
export(TARGETS loot
|
||||
export(TARGETS libloot
|
||||
NAMESPACE libloot::
|
||||
FILE "${PROJECT_BINARY_DIR}/liblootTargets.cmake")
|
||||
|
||||
if(MSVC)
|
||||
install(FILES $<TARGET_PDB_FILE:loot>
|
||||
install(FILES $<TARGET_PDB_FILE:libloot>
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
OPTIONAL
|
||||
CONFIGURATIONS RelWithDebInfo)
|
||||
|
||||
@@ -76,7 +76,7 @@ endif()
|
||||
|
||||
# Build API tests.
|
||||
add_executable(libloot_tests ${LIBLOOT_INTERFACE_TESTS_ALL_SOURCES})
|
||||
target_link_libraries(libloot_tests PRIVATE loot GTest::gtest_main)
|
||||
target_link_libraries(libloot_tests PRIVATE libloot GTest::gtest_main)
|
||||
|
||||
enable_testing()
|
||||
gtest_discover_tests(libloot_tests DISCOVERY_TIMEOUT 10)
|
||||
|
||||
Reference in New Issue
Block a user