![]() ![]() Youll also need to install CMake, a compiler, a debugger, and build tools. and users can still provide their own FindThirdParty.cmake and prepend the CMAKE_PREFIX_PATH if they want to change. Install the CMake Tools extension by searching for CMake tools in the Extensions view ( Ctrl+Shift+X ). So you don't have to play with CMAKE_PREFIX_PATH or dependencies.cmake etc. So first, to make your CMakeLists completely agnostic on where to find the packages, we will create a new file called linux-dependencies.cmake with this content: list(APPEND CMAKE_PREFIX_PATH "$ENV/Desktop/MORPH/build") ![]() On windows it may not matter as the filesystem is not case sensitive, but on linux it is. This is important for CMake to find the packages correctly. Then, you will have to drop the ALL_CAPS for the directory name. The trick will be to use find_package for all your dependencies, and you must drop every custom Findxyz.cmake files. On linux, I will assume that the libraries are installed in ~/workspace/libraries. You are lucky as both the three libraries you use export their packages correctly. PRIVATE C:/Users/dylan/Desktop/MORPH/MORPH_Shared_Functions Set_target_properties(MORPH_Shared_Functions PROPERTIES IMPORTED_LOCATION C:/Users/dylan/Desktop/MORPH/MORPH_Shared_Functions/Build/Debug/MORPH_Shared_Functions.lib) Server CMakeLists.txt: cmake_minimum_required(VERSION 3.10)Ĭonfigure_file(CmakeConfig.h.in CmakeConfig.h)Īdd_library(MORPH_Shared_Functions STATIC IMPORTED) PRIVATE C:/libraries/SFML/SFML-2.5.1/include Install the latest CMake As of writing the latest version of CMake is 3.20.2 which can be installed using one of the following two options: Option 1: Use Snappy Using the Snappy package manager is the quickest and easiest way to install the latest version of CMake on Ubuntu Linux. Target_include_directories(MORPH_Shared_Functions Sfml-system #Basically already found sfml modules and their dependencies (find-package) Target_link_libraries(MORPH_Shared_Functions Set(SFML_DIR "C:/libraries/SFML/SFML圆4SourceAndCompile")įind_package(SFML 2.5.1 COMPONENTS system network REQUIRED) Set(SFML_STATIC_LIBRARIES TRUE) #Link to statically Shared Lib CMakeLists.txt: cmake_minimum_required(VERSION 3.10) ![]() Question: How can I adapt these CMakeLists.txt's (currently building on and for Windows), so I can choose if I want to compile for Windows or Linux (preferably from Windows)? I heard I could do this by wrapping my 3 currently VisualStudio developed projects into a CMake environment, so I started by making CMakeLists.txt's for Server and Shared lib, which are the simplest and have fewer library dependencies. Server and Client both depend on various libraries I prefer linking statically, and headers. Context: I want to make a GameClient, GameServer, and custom library (which both Client and Server use) cross platform for Linux, Windows & MacOS. ![]()
0 Comments
Leave a Reply. |