open-dis-cpp icon indicating copy to clipboard operation
open-dis-cpp copied to clipboard

building open-dis-cpp with cmake

Open AJPerriello opened this issue 1 year ago • 2 comments

I want to build open-dis ccp dis6 source as a shared library. I don't need examples. I am building on a machine that has cmake and most everything needed for development. If this build is going to need more than I can not install that, need to work with what I have, which should be enough anyhow, can I please have an example of linux command line to cmake and build

i tried .. cmake -BUILD_SHARED_LIBS=ON -DBUILD_EXAMPLES=OFF -S src (I'm sunning that in a directory that contains src/dis6, src/dis7 CMakeLists.txt I tried using cmake3 as well cmake -h doesn't help much :) Do I need to make entries in CMakeLists? I assumed, just download, install, and do cmake -S -B and turn on SHARED_LIBS, but so far isn't working. thanks

AJPerriello avatar Dec 13 '23 12:12 AJPerriello

There could be a couple of things going on here based on the command you ran. Try the following:

git clone https://github.com/open-dis/open-dis-cpp.git
cd open-dis-cpp
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/path/to/install ..
cmake --build .
cmake --install .

The key is to do an out-of-source build and point the source directory to where the top-level CMakeLists.txt file is located.

wadehunk avatar Dec 13 '23 19:12 wadehunk

@leif81 We could update the README to be a little more explicit on using CMake. I might throw this into #83.

crhowell3 avatar Jan 18 '24 17:01 crhowell3