Skip to content

Commit

Permalink
Add cmake support (#2)
Browse files Browse the repository at this point in the history
* add cmake support

* fix include and lib paths
  • Loading branch information
songweijia authored and mpmilano committed Apr 7, 2019
1 parent aaba04f commit 6374730
Show file tree
Hide file tree
Showing 34 changed files with 62 additions and 4 deletions.
56 changes: 56 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
cmake_minimum_required (VERSION 3.1)
project (mutils-tasks)

#Versions
set(mutils_tasks_VERSION 1.0)

#CXX FLAGS
set(CMAKE_CXX_FLAGS "-std=c++14 -fPIC -DMAX_THREADS=10000")
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS})
set(CMAKE_CXX_FLAGS_DEBUG "-std=c++14 -fPIC -DMAX_THREADS=10000 -g")
set(CMAKE_SHARED_LINKER_FLAGS "-shared --enable-new-dtags")

#Check dependencies
find_package(mutils 1.0)
if(NOT ${mutils_FOUND})
message( FATAL_ERROR "mutils not found.")
endif(NOT ${mutils_FOUND})

add_library(mutils-tasks SHARED FutureFreePool.cpp GlobalPool.cpp)
target_include_directories(mutils-tasks PRIVATE
$<BUILD_INTERFACE:${mutils-tasks_SOURCE_DIR}/include>)

#Make install
install(TARGETS mutils-tasks EXPORT mutils-tasks
LIBRARY DESTINATION lib)
install(DIRECTORY include/mutils-tasks
DESTINATION include)

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/mutils-tasks/mutils-tasksConfigVersion.cmake"
VERSION ${mutils_tasks_VERSION}
COMPATIBILITY AnyNewerVersion
)

export (EXPORT mutils-tasks
FILE "${CMAKE_CURRENT_BINARY_DIR}/mutils-tasks/mutils-tasksTargets.cmake"
)

configure_file (mutils-tasksConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/mutils-tasks/mutils-tasksConfig.cmake"
COPYONLY
)

set(ConfigPackageLocation lib/cmake/mutils-tasks)
install(EXPORT mutils-tasks
FILE mutils-tasksTargets.cmake
DESTINATION ${ConfigPackageLocation}
)

install(
FILES
mutils-tasksConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/mutils-tasks/mutils-tasksConfigVersion.cmake"
DESTINATION ${ConfigPackageLocation}
)
6 changes: 3 additions & 3 deletions FutureFreePool.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "FutureFreePool.hpp"
#include "GlobalPool.hpp"
#include "mutils-tasks/FutureFreePool.hpp"
#include "mutils-tasks/GlobalPool.hpp"
#include <list>
#include "../mutils/AtScopeEnd.hpp"
#include "mutils/AtScopeEnd.hpp"

using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion GlobalPool.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include "GlobalPool.hpp"
#include "mutils-tasks/GlobalPool.hpp"

GlobalPool GlobalPool::inst;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions mutils-tasksConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set(mutils-tasks_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include")
set(mutils-tasks_LIBRARIES "-L${CMAKE_INSTALL_PREFIX}/lib -lmutils-tasks")

0 comments on commit 6374730

Please sign in to comment.