cellar/CMakeLists.txt

70 lines
2.3 KiB
CMake
Raw Normal View History

2017-03-23 01:03:33 -07:00
cmake_minimum_required(VERSION 3.7.2)
2017-03-23 01:03:56 -07:00
project(cellar CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2017-03-23 01:03:33 -07:00
# local cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/Modules)
2017-03-23 13:36:38 -07:00
# for installation rules, from CMake wiki
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/cellar")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
2017-03-23 01:03:33 -07:00
find_package(PythonInterp)
find_package(PythonModule)
find_python_module(cogapp REQUIRED)
2017-03-23 01:03:56 -07:00
find_package(Boost 1.63 REQUIRED COMPONENTS filesystem)
2017-03-23 01:03:33 -07:00
find_package(PkgConfig)
pkg_check_modules(TCLAP "tclap >= 1.2.1")
if(NOT TCLAP_FOUND)
MESSAGE(WARNING "TCLAP is required by this project, but was not found by CMake.
Continuing on the assumption that you've downloaded it from
http://tclap.sourceforge.net and put the headers in ./include
(wink, nudge)")
endif(NOT TCLAP_FOUND)
2017-03-23 01:03:33 -07:00
include_directories(include)
set(src "${CMAKE_SOURCE_DIR}/src")
2017-03-23 01:03:33 -07:00
set(coggedfiles)
file(GLOB_RECURSE cogfiles RELATIVE "${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/*.cog")
2017-03-23 01:03:33 -07:00
foreach(cogfile ${cogfiles})
2017-03-23 01:03:56 -07:00
string(REGEX REPLACE ".cog\$" "" outfile "${cogfile}")
set(thisfile "${CMAKE_SOURCE_DIR}/${outfile}")
2017-03-23 01:03:33 -07:00
2017-03-23 14:43:48 -07:00
add_custom_command(OUTPUT "${thisfile}" PRE_BUILD
2017-03-23 01:03:33 -07:00
COMMAND ${PYTHON_EXECUTABLE} -m cogapp -d -o "${outfile}" "${cogfile}"
DEPENDS ${cogfile}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
2017-03-24 15:57:49 -07:00
COMMENT "Greasing the cog for ${outfile}")
2017-03-23 01:03:33 -07:00
2017-03-23 01:03:56 -07:00
set(coggedfiles ${coggedfiles} "${thisfile}")
2017-03-23 01:03:33 -07:00
endforeach(cogfile)
add_library(bottles SHARED ${src}/bottles/bottles.cpp
2017-03-23 15:03:07 -07:00
${src}/bottles/active.cpp ${src}/bottles/commands.cpp
2017-03-24 15:57:49 -07:00
${src}/bottles/activate.cpp ${src}/bottles/config/cli_handler.cpp)
2017-03-23 14:43:48 -07:00
add_dependencies(bottles cog)
2017-03-23 12:06:29 -07:00
2017-03-23 21:20:26 -07:00
add_library(launch SHARED ${src}/launch/launch.cpp ${src}/launch/commands.cpp
${src}/launch/shortcuts.cpp)
2017-03-23 01:03:56 -07:00
add_custom_target(cog ALL DEPENDS ${coggedfiles})
2017-03-23 01:03:33 -07:00
2017-03-23 01:03:56 -07:00
add_executable(cellar ${src}/cellar.cpp ${src}/commands.cpp ${src}/fs.cpp
${src}/version.cpp ${src}/output.cpp)
2017-03-23 21:20:26 -07:00
target_link_libraries(cellar ${Boost_LIBRARIES} bottles launch)
2017-03-23 13:36:38 -07:00
2017-03-23 21:23:01 -07:00
install(TARGETS cellar bottles launch
2017-03-23 13:36:38 -07:00
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib/cellar
ARCHIVE DESTINATION share/cellar)