mhulden / foma

Automatically exported from code.google.com/p/foma
117 stars 90 forks source link

Add CMakeLists.txt #138

Closed ttti07 closed 1 year ago

ttti07 commented 2 years ago

CMake is a cross-platform family of tools designed to build, test and package software. It is one of the de facto standard tools in C/C++ projects today.

Typical Usage

cd foma
mkdir build
cd build
cmake ..
make -j install

Link to foma library

in my_project/CMakeLists.txt

find_package(foma)

add_library(my_app blarblar.c)
target_link_libraries(my_app foma)

add_library(my_app2 foobar.c  $<TARGET_OBJECTS:foma>)
cd my_project
mkdir build
cd build
cmake ..
# If you did not install foma in the system path, you should provide some hint to cmake command, like below.
# cmake .. -Dfoma_DIR=/your/path/to/apps/lib/cmake/foma
make -j

Otherwise, just embed foma source codes on your project

cd my_project
git submodule add https://github.com/mhulden/foma.git third_party/foma
git submodule init
git submodule update

in my_project/CMakeLists.txt

add_subdirectory(third_party/foma EXCLUDE_FROM_ALL)

add_library(my_app blarblar.c)
target_link_libraries(my_app foma)

add_library(my_app2 foobar.c  $<TARGET_OBJECTS:foma>)

Then run cmake and make, the same as above.

AmbientLighter commented 2 years ago

@ttti07 Would be nice to check if it is working for different OS by calling CMake from CI workflow.

ttti07 commented 2 years ago

@AmbientLighter I added some commands to build.yml. Thanks for your guide.

wincentbalin commented 2 years ago

Isn't this pull request superceded by pull request #141?

AmbientLighter commented 2 years ago

Yes, it makes sense to close this pull request.