Whats up?
What might be causing this error while trying to compile?:
Ps: I am using MacOS Monterey.
[ 99%] Building CXX object src/CMakeFiles/otclient.dir/main.cpp.o make[2]: No rule to make target /usr/local/lib/liblua5.1.dylib}', needed by bin/otclient'. Stop. make[1]: [src/CMakeFiles/otclient.dir/all] Error 2 make: *** [all] Error 2
Here is my CmakeLists.txt:
project(otclient)
# *****************************************************************************
# Options
# *****************************************************************************
option(FRAMEWORK_SOUND "Use SOUND " ON)
option(FRAMEWORK_XML "Use XML " ON)
option(FRAMEWORK_NET "Use NET " ON)
option(FRAMEWORK_SQL "Use SQL" OFF)
option(TOOGLE_DIRECTX "Use DX9 support" OFF)
# *****************************************************************************
# Cmake Features
# *****************************************************************************
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Make will print more details
set(CMAKE_VERBOSE_MAKEFILE OFF)
# Generate compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(Boost_USE_MULTITHREADED ON)
# Define Framework Options for use in compilation
set(FRAMEWORK_DEFINITIONS "")
if (FRAMEWORK_SOUND)
set(FRAMEWORK_DEFINITIONS ${FRAMEWORK_DEFINITIONS} -DFRAMEWORK_SOUND)
endif()
if (FRAMEWORK_XML)
set(FRAMEWORK_DEFINITIONS ${FRAMEWORK_DEFINITIONS} -DFRAMEWORK_XML)
endif()
if (FRAMEWORK_NET)
set(FRAMEWORK_DEFINITIONS ${FRAMEWORK_DEFINITIONS} -DFRAMEWORK_NET)
endif()
set(VERSION "1.0.0")
# *****************************************************************************
# Client
# *****************************************************************************
if (MSVC)
add_executable(${PROJECT_NAME} "" ../cmake/icon/otcicon.rc)
else()
add_executable(${PROJECT_NAME} "")
endif()
add_definitions(-D_WIN32_WINNT=0x0501)
add_definitions(${FRAMEWORK_DEFINITIONS})
add_definitions(-D"VERSION=\\"${VERSION}\\"")
# *****************************************************************************
# Packages / Libs
# *****************************************************************************
find_package(Boost 1.53.0 COMPONENTS system thread filesystem REQUIRED)
find_package(OpenSSL QUIET)
find_package(PhysFS REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Protobuf REQUIRED)
find_package(LibLZMA REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(Lua REQUIRED)
# OpenGL/GLEW =
## TODO: CMake Documentation says that this is not the right
# Thing for Mac OS X, but it works for now.
if(APPLE)
include_directories(/usr/X11R6/include/)
link_directories(/usr/X11R6/lib/)
SET(OPENGL_LIBRARIES GL)
else()
find_package(OpenGL REQUIRED)
endif()
find_package(GLEW REQUIRED)
if (WIN32)
find_package(DbgHelp REQUIRED)
endif(WIN32)
if(NOT OPENSSL_FOUND)
find_package(GMP REQUIRED)
endif()
if(TOOGLE_DIRECTX)
find_package(DirectX REQUIRED)
endif()
if(FRAMEWORK_SOUND)
find_package(OpenAL REQUIRED)
find_package(VorbisFile REQUIRED)
find_package(Vorbis REQUIRED)
find_package(Ogg REQUIRED)
endif()
if(FRAMEWORK_SQL)
find_package(MySQL REQUIRED)
endif()
# *****************************************************************************
# OTClient source files configuration
# *****************************************************************************
target_sources(${PROJECT_NAME}
PRIVATE
client/animatedtext.cpp
client/animator.cpp
client/spriteappearances.cpp
client/client.cpp
client/container.cpp
client/creature.cpp
client/creatures.cpp
client/effect.cpp
client/game.cpp
client/houses.cpp
client/item.cpp
client/itemtype.cpp
client/lightview.cpp
client/localplayer.cpp
client/luafunctions.cpp
client/luavaluecasts.cpp
client/map.cpp
client/mapio.cpp
client/mapview.cpp
client/minimap.cpp
client/missile.cpp
client/outfit.cpp
client/player.cpp
client/protocolcodes.cpp
client/protocolgame.cpp
client/protocolgameparse.cpp
client/protocolgamesend.cpp
client/shadermanager.cpp
client/spritemanager.cpp
client/statictext.cpp
client/thing.cpp
client/thingtype.cpp
client/thingtypemanager.cpp
client/tile.cpp
client/towns.cpp
client/uicreature.cpp
client/uiitem.cpp
client/uimap.cpp
client/uimapanchorlayout.cpp
client/uiminimap.cpp
client/uiprogressrect.cpp
client/uisprite.cpp
framework/core/adaptativeframecounter.cpp
framework/core/application.cpp
framework/core/asyncdispatcher.cpp
framework/core/binarytree.cpp
framework/core/clock.cpp
framework/core/config.cpp
framework/core/configmanager.cpp
framework/core/event.cpp
framework/core/eventdispatcher.cpp
framework/core/filestream.cpp
framework/core/graphicalapplication.cpp
framework/core/logger.cpp
framework/core/module.cpp
framework/core/modulemanager.cpp
framework/core/resourcemanager.cpp
framework/core/scheduledevent.cpp
framework/core/timer.cpp
framework/graphics/animatedtexture.cpp
framework/graphics/apngloader.cpp
framework/graphics/bitmapfont.cpp
framework/graphics/cachedtext.cpp
framework/graphics/coordsbuffer.cpp
framework/graphics/drawpool.cpp
framework/graphics/fontmanager.cpp
framework/graphics/framebuffer.cpp
framework/graphics/framebuffermanager.cpp
framework/graphics/graphics.cpp
framework/graphics/image.cpp
framework/graphics/ogl/painterogl.cpp
framework/graphics/ogl/painterogl1.cpp
framework/graphics/ogl/painterogl2.cpp
framework/graphics/painter.cpp
framework/graphics/paintershaderprogram.cpp
framework/graphics/particle.cpp
framework/graphics/particleaffector.cpp
framework/graphics/particleeffect.cpp
framework/graphics/particleemitter.cpp
framework/graphics/particlemanager.cpp
framework/graphics/particlesystem.cpp
framework/graphics/particletype.cpp
framework/graphics/pool.cpp
framework/graphics/shader.cpp
framework/graphics/shaderprogram.cpp
framework/graphics/texture.cpp
framework/graphics/texturemanager.cpp
framework/input/mouse.cpp
framework/luaengine/lbitlib.cpp
framework/luaengine/luaexception.cpp
framework/luaengine/luainterface.cpp
framework/luaengine/luaobject.cpp
framework/luaengine/luavaluecasts.cpp
framework/luafunctions.cpp
framework/net/connection.cpp
framework/net/inputmessage.cpp
framework/net/outputmessage.cpp
framework/net/protocol.cpp
framework/net/protocolhttp.cpp
framework/net/server.cpp
framework/otml//otmldocument.cpp
framework/otml//otmlemitter.cpp
framework/otml//otmlexception.cpp
framework/otml//otmlnode.cpp
framework/otml//otmlparser.cpp
framework/platform/platform.cpp
framework/platform/platformwindow.cpp
framework/platform/unixcrashhandler.cpp
framework/platform/unixplatform.cpp
framework/platform/win32crashhandler.cpp
framework/platform/win32platform.cpp
framework/platform/win32window.cpp
framework/platform/x11window.cpp
framework/sound/combinedsoundsource.cpp
framework/sound/oggsoundfile.cpp
framework/sound/soundbuffer.cpp
framework/sound/soundchannel.cpp
framework/sound/soundfile.cpp
framework/sound/soundmanager.cpp
framework/sound/soundsource.cpp
framework/sound/streamsoundsource.cpp
framework/stdext/demangle.cpp
framework/stdext/math.cpp
framework/stdext/net.cpp
framework/stdext/string.cpp
framework/stdext/time.cpp
framework/ui/uianchorlayout.cpp
framework/ui/uiboxlayout.cpp
framework/ui/uigridlayout.cpp
framework/ui/uihorizontallayout.cpp
framework/ui/uilayout.cpp
framework/ui/uimanager.cpp
framework/ui/uiparticles.cpp
framework/ui/uitextedit.cpp
framework/ui/uitranslator.cpp
framework/ui/uiverticallayout.cpp
framework/ui/uiwidget.cpp
framework/ui/uiwidgetbasestyle.cpp
framework/ui/uiwidgetimage.cpp
framework/ui/uiwidgettext.cpp
framework/util/color.cpp
framework/util/crypt.cpp
framework/xml/tinystr.cpp
framework/xml/tinyxml.cpp
framework/xml/tinyxmlerror.cpp
framework/xml/tinyxmlparser.cpp
protobuf/appearances.pb.cc
main.cpp
)
# *****************************************************************************
# Includes and librarys
# *****************************************************************************
if(MSVC)
target_include_directories(${PROJECT_NAME}
PRIVATE
${CMAKE_SOURCE_DIR}/src
${MYSQL_INCLUDE_DIR}
${LUAJIT_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
${Protobuf_INCLUDE_DIRS}
${OPENAL_INCLUDE_DIR}
${VORBISFILE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
${GMP_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
${PHYSFS_INCLUDE_DIR}
${LIBLZMA_INCLUDE_DIRS}
${NLOHMANN_JSON_INCLUDE_DIR}
)
target_link_libraries(${PROJECT_NAME}
PRIVATE
${MYSQL_CLIENT_LIBS}
${LUAJIT_LIBRARY}
${Boost_LIBRARY_DIRS}
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${PHYSFS_LIBRARY}
${ZLIB_LIBRARY}
${PROTOBUF_LIBRARY}
${LIBLZMA_LIBRARIES}
${NLOHMANN_JSON_LIBRARY}
${GLEW_LIBRARY}
${OPENGL_LIBRARIES}
${DirectX_LIBRARY}
${DirectX_LIBRARIES}
${OPENAL_LIBRARY}
${VORBISFILE_LIBRARY}
${VORBIS_LIBRARY}
${OGG_LIBRARY}
${MYSQL_LIBRARY}
${GMP_LIBRARY}
${OPENSSL_LIBRARIES}
${DBGHELP_LIBRARY}
GLEW::GLEW
)
else()
target_include_directories(${PROJECT_NAME}
PRIVATE
${CMAKE_SOURCE_DIR}/src
${LUA_INCLUDE_DIR}
${Protobuf_INCLUDE_DIRS}
${OPENAL_INCLUDE_DIR}
${VORBISFILE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
${GMP_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR}
${PHYSFS_INCLUDE_DIR}
${LIBLZMA_INCLUDE_DIRS}
${NLOHMANN_JSON_INCLUDE_DIR}
)
target_link_libraries(${PROJECT_NAME}
PRIVATE
${LUA_LIBRARY}}
${PHYSFS_LIBRARY}
${ZLIB_LIBRARY}
${PROTOBUF_LIBRARY}
${LIBLZMA_LIBRARIES}
${NLOHMANN_JSON_LIBRARY}
${GLEW_LIBRARY}
${OPENGL_LIBRARIES}
${DirectX_LIBRARY}
${DirectX_LIBRARIES}
${OPENAL_LIBRARY}
${VORBISFILE_LIBRARY}
${VORBIS_LIBRARY}
${OGG_LIBRARY}
${MYSQL_LIBRARY}
${GMP_LIBRARY}
${OPENSSL_LIBRARIES}
${OPENGL_LIBRARY}
Boost::boost
Boost::filesystem
Boost::system
Threads::Threads
)
endif()
# *****************************************************************************
# Enable otclient console only for debug build
# *****************************************************************************
if(WIN32)
set_target_properties(${PROJECT_NAME}
PROPERTIES
LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE"
LINK_FLAGS_RELEASE "/SUBSYSTEM:windows /ENTRY:mainCRTStartup"
LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:windows /ENTRY:mainCRTStartup"
LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:windows /ENTRY:mainCRTStartup"
)
endif(WIN32)
# *****************************************************************************
# Link compilation files to the "build/release/bin" folder
# *****************************************************************************
set_target_properties(${PROJECT_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
EDIT:
Makefile generated by cmake:
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.22
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Disable VCS-based implicit rules.
% : %,v
# Disable VCS-based implicit rules.
% : RCS/%
# Disable VCS-based implicit rules.
% : RCS/%,v
# Disable VCS-based implicit rules.
% : SCCS/s.%
# Disable VCS-based implicit rules.
% : s.%
.SUFFIXES: .hpux_make_needs_suffix_list
# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s
#Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/local/Cellar/cmake/3.22.3/bin/cmake
# The command to remove a file.
RM = /usr/local/Cellar/cmake/3.22.3/bin/cmake -E rm -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/mpgmateus/Downloads/otclient-rework-cmake
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/mpgmateus/Downloads/otclient-rework-cmake/build
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
/usr/local/Cellar/cmake/3.22.3/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/local/Cellar/cmake/3.22.3/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /Users/mpgmateus/Downloads/otclient-rework-cmake/build/CMakeFiles /Users/mpgmateus/Downloads/otclient-rework-cmake/build//CMakeFiles/progress.marks
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /Users/mpgmateus/Downloads/otclient-rework-cmake/build/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named protobuf
# Build rule for target.
protobuf: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 protobuf
.PHONY : protobuf
# fast build rule for target.
protobuf/fast:
$(MAKE) $(MAKESILENT) -f src/protobuf/CMakeFiles/protobuf.dir/build.make src/protobuf/CMakeFiles/protobuf.dir/build
.PHONY : protobuf/fast
#=============================================================================
# Target rules for targets named otclient
# Build rule for target.
otclient: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 otclient
.PHONY : otclient
# fast build rule for target.
otclient/fast:
$(MAKE) $(MAKESILENT) -f src/CMakeFiles/otclient.dir/build.make src/CMakeFiles/otclient.dir/build
.PHONY : otclient/fast
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... rebuild_cache"
@echo "... otclient"
@echo "... protobuf"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
I will be very grateful for your help ;)
Thanks!
CodePudding user response:
I found out the reason, is that the include of the library has an extra "}".