Hi
I would like to use Teamspeak in a TrinityCore that uses Cmake.
But I have a problem that I can’t import the TeamSpeak library.
Here is my Cmakelists.txt configuration:
But when I compile in visual studio :
Error LNK1181 cannot open input file ‘TSClientSdk .lib’ worldserver C:\Users\tchou\Documents\BuildWow\src\serverworldserver\LINK 1
Does anyone have a procedure to add the Teamspeak library in Cmake ?
Thanks a lot !
IMPLIB on Windows is for the .lib while the .dll belongs in IMPORTED_LOCATION. The import/runtime library split is the cause of this necessity (and, for other reasons, the DLL is better in LOCATION).
Thanks for your help, I modified the file as you suggested. I deleted the cache and redid my configuration and I can’t find out if it is really imported on Cmake:
Detected 64-bit platform
MSVC: Minimum version required is 19.30, found 19.34.31937.0 - ok!
MSVC: 64-bit platform, enforced -D_WIN64 parameter
MSVC: Enabled increased number of sections in object files
MSVC: Overloaded standard names
MSVC: Disabled NON-SECURE warnings
MSVC: Disabled POSIX warnings
MSVC: Disabled generic compiletime warnings
Found MySQL: found components: binary
Found MySQL executable: C:/Program Files/MySQL/MySQL Server 8.0/bin/mysql.exe
* TrinityCore revision : b6820a706f46+ 2023-01-08 00:01:09 +0100 (master branch)
* Install core to : C:/Program Files/TrinityCore
* Install configs to : C:/Program Files/TrinityCore
* Build world/auth : Yes (default)
* Build with scripts : Yes (static)
* Build map/vmap tools : Yes (default)
* Build unit tests : No (default)
* Build core w/PCH : Yes (default)
* Build scripts w/PCH : Yes (default)
* Show compile-warnings : No (default)
* Use coreside debug : No (default)
* Show source tree : Yes (hierarchical)
* Use GIT revision hash : Yes (default)
CMake Warning at C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:1384 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
dep/boost/CMakeLists.txt:31 (find_package)
CMake Warning at C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:1384 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
dep/boost/CMakeLists.txt:31 (find_package)
CMake Warning at C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:1384 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
dep/boost/CMakeLists.txt:31 (find_package)
CMake Warning at C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:1384 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
dep/boost/CMakeLists.txt:31 (find_package)
CMake Warning at C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:1384 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.25/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
dep/boost/CMakeLists.txt:31 (find_package)
Found MySQL: C:/Program Files/MySQL/MySQL Server 8.0/lib/libmysql.lib found components: lib
Found MySQL library: C:/Program Files/MySQL/MySQL Server 8.0/lib/libmysql.lib
Found MySQL headers: C:/Program Files/MySQL/MySQL Server 8.0/include
adding TeamSpeak Client SDK
CMAKE_SYSTEM_NAME: Windows
CMAKE_SYSTEM_PROCESSOR AMD64
CMAKE_GENERATOR_PLATFORM x64
TS_LIB_PATH: windows/win64
adding TeamSpeak Server SDK
CMAKE_SYSTEM_NAME: Windows
CMAKE_SYSTEM_PROCESSOR AMD64
TS_LIB_PATH: windows/win64
* Script configuration (static):
|
+- worldserver
| +- Argus
| +- Battlefield
| +- BrokenIsles
| +- Commands
| +- Custom
| +- Draenor
| +- DragonIsles
| +- EasternKingdoms
| +- Events
| +- Kalimdor
| +- Maelstrom
| +- Northrend
| +- OutdoorPvP
| +- Outland
| +- Pandaria
| +- Pet
| +- Spells
| +- VoiceChat
| +- World
|
Configuring done
Generating done
Then in my project to import I have a file cmakelists.txt in a folder scripts having added the library like this:
# Add the dynamic script modules to the worldserver as dependency
set(WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES ${DYNAMIC_SCRIPT_MODULE_PROJECTS} PARENT_SCOPE)
ConfigureScriptLoader("static" SCRIPT_MODULE_PRIVATE_SCRIPTLOADER OFF ${STATIC_SCRIPT_MODULES})
add_library(scripts STATIC
ScriptLoader.h
${SCRIPT_MODULE_PRIVATE_SCRIPTLOADER}
${PRIVATE_SOURCES})
target_link_libraries(scripts
PRIVATE
trinity-core-interface
PUBLIC
game-interface
TSClientSdk)
target_include_directories(scripts
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(scripts
PROPERTIES
FOLDER
"scripts")
Okay thanks, then I don’t understand why it doesn’t work. When I compile my project on Visual Studio 2022 I get this error:
Error LNK1181 cannot open input file ‘TSClientSdk.lib’ worldserver C:\Users\tchou\Documents\BuildWow\src\serverworldserver\LINK 1
Is there a #pragma comment(TSClientSdk.lib) in the TeamSpeak sources (called “autolinking”)? That tells the MSVC linker to also look for something; if you’re missing the link directory you’ll see something like this. There may be a define you can set it skip over it.
Hi there,
Is the variable "${TSClientSdk_LIBRARY}" giving you the path to the library? It seems to me that the windows path is not set to the correct location.
Try to output the variable content with message in CMake to see what it contains.
Yes, I saw it, I just was wondering if it was really found by CMake.
I had similar issues because of that, the path was even configured well the variable was empty. What it looks like to me is that CMake is trying to link with TSClientSdk.lib instead of ts3client.lib.
I have similar statements for importing already compiled libs, but I don’t get why it does not work for him, and is just looking for the incorrect library name.