Link 1st-party library with CMake

  c++, clion, cmake, game-engine, macos

I want to make a game in C++ and my goal is to isolate the game engine code from the game logic code, so I can potentially reuse some of the logic and have separate git repos:

+-- MyPersonalProjects
|  +-- TheEngine (library)
|  |  +-- src...
|  +-- TheGame (depends on TheEngine)
|  |  +-- src...
|  +-- AnotherGame (depends on TheEngine)
|  |  +-- src...

I’m new to C++ (coming from Unity C#), so the build system is still something I’m trying to figure out.

Using CMake, how would I go about linking the engine to the game? Using a relative path? Copying the .a file to each engine? Or is there a better way to go about this?

IDE: CLion for Mac

Source: Windows Questions C++

LEAVE A COMMENT