cmake: Cleanup

This commit is contained in:
Michael Carlberg 2016-06-23 23:31:03 +02:00
parent 8b7f2b7268
commit 52335d4f63
2 changed files with 26 additions and 28 deletions

View File

@ -6,9 +6,8 @@ cmake_minimum_required(VERSION 3.0)
# TODO(jaagr): Replace with git tag # TODO(jaagr): Replace with git tag
project(lemonbuddy VERSION 1.2.2) project(lemonbuddy VERSION 1.2.2)
set(CMAKE_MODULE_PATH # Include the local cmake modules
"${CMAKE_MODULE_PATH}" set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wpedantic -Wno-unused-parameter") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wpedantic -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3 -DDEBUG") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3 -DDEBUG")
@ -82,11 +81,22 @@ set(PROJECT_LINK_LIBS
if(ENABLE_I3) if(ENABLE_I3)
find_program(I3_EXECUTABLE "i3") find_program(I3_EXECUTABLE "i3")
if(NOT I3_EXECUTABLE AND NOT ENABLE_I3_NODEF) if(I3_EXECUTABLE)
add_subdirectory("${PROJECT_SOURCE_DIR}/contrib/i3ipcpp" EXCLUDE_FROM_ALL)
set(PROJECT_INCL_DIRS
${PROJECT_INCL_DIRS}
${SIGCPP_INCLUDE_DIRS}
${I3IPCPP_INCLUDE_DIRS})
set(PROJECT_LINK_LIBS
${PROJECT_LINK_LIBS}
${I3IPCPP_LIBRARIES})
else(I3_EXECUTABLE)
if(NOT ENABLE_I3_NODEF)
message(WARNING "${ANSI}[41;1mDisabling \"i3 module\" support (prerequisites failed)${ANSI}[0m") message(WARNING "${ANSI}[41;1mDisabling \"i3 module\" support (prerequisites failed)${ANSI}[0m")
set(ENABLE_I3 OFF) set(ENABLE_I3 OFF)
endif() endif()
endif() endif()
endif()
if(ENABLE_ALSA) if(ENABLE_ALSA)
find_package("ALSA") find_package("ALSA")
@ -152,17 +162,6 @@ add_executable(${PROJECT_NAME} ${FILES}
"examples/config" "examples/config"
"examples/config.bspwm" "examples/config.bspwm"
"examples/config.i3") "examples/config.i3")
if(ENABLE_I3)
add_subdirectory("${PROJECT_SOURCE_DIR}/contrib/i3ipcpp" EXCLUDE_FROM_ALL)
set(PROJECT_INCL_DIRS ${PROJECT_INCL_DIRS}
${SIGCPP_INCLUDE_DIRS}
${I3IPCpp_INCLUDE_DIRS})
set(PROJECT_LINK_LIBS ${PROJECT_LINK_LIBS} ${I3IPCpp_LIBRARIES})
endif()
include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} ${PROJECT_INCL_DIRS})
target_link_libraries(${PROJECT_NAME} ${PROJECT_LINK_LIBS}) target_link_libraries(${PROJECT_NAME} ${PROJECT_LINK_LIBS})
configure_file("${CMAKE_SOURCE_DIR}/include/config.hpp.cmake" "${CMAKE_SOURCE_DIR}/include/config.hpp" ESCAPE_QUOTES @ONLY) configure_file("${CMAKE_SOURCE_DIR}/include/config.hpp.cmake" "${CMAKE_SOURCE_DIR}/include/config.hpp" ESCAPE_QUOTES @ONLY)

View File

@ -1,30 +1,30 @@
if(ENABLE_ALSA) if(ENABLE_ALSA)
set(SOURCE_FILES_ALSA set(FILES_ALSA
"src/interfaces/alsa.cpp" "src/interfaces/alsa.cpp"
"src/modules/volume.cpp") "src/modules/volume.cpp")
endif() endif()
if(ENABLE_MPD) if(ENABLE_MPD)
set(SOURCE_FILES_MPD set(FILES_MPD
"src/interfaces/mpd.cpp" "src/interfaces/mpd.cpp"
"src/modules/mpd.cpp") "src/modules/mpd.cpp")
endif() endif()
if(ENABLE_NETWORK) if(ENABLE_NETWORK)
set(SOURCE_FILES_NETWORK set(FILES_NETWORK
"src/interfaces/net.cpp" "src/interfaces/net.cpp"
"src/modules/network.cpp") "src/modules/network.cpp")
endif() endif()
if(ENABLE_I3) if(ENABLE_I3)
set(SOURCE_FILES_I3 "src/modules/i3.cpp") set(FILES_I3 "src/modules/i3.cpp")
endif() endif()
set(SOURCE_FILES set(FILES
${SOURCE_FILES_ALSA} ${FILES_ALSA}
${SOURCE_FILES_I3} ${FILES_I3}
${SOURCE_FILES_MPD} ${FILES_MPD}
${SOURCE_FILES_NETWORK} ${FILES_NETWORK}
"src/drawtypes/animation.cpp" "src/drawtypes/animation.cpp"
"src/drawtypes/bar.cpp" "src/drawtypes/bar.cpp"
"src/drawtypes/icon.cpp" "src/drawtypes/icon.cpp"
@ -46,13 +46,12 @@ set(SOURCE_FILES
"src/services/event_throttler.cpp" "src/services/event_throttler.cpp"
"src/services/inotify.cpp" "src/services/inotify.cpp"
"src/services/logger.cpp" "src/services/logger.cpp"
# "src/services/store.cpp"
"src/utils/cli.cpp" "src/utils/cli.cpp"
"src/utils/config.cpp" "src/utils/config.cpp"
"src/utils/io.cpp" "src/utils/io.cpp"
"src/utils/proc.cpp" "src/utils/proc.cpp"
"src/utils/string.cpp" "src/utils/string.cpp"
"src/utils/xlib.cpp" "src/utils/xcb.cpp"
"src/bar.cpp" "src/bar.cpp"
"src/eventloop.cpp" "src/eventloop.cpp"
"src/lemonbuddy.cpp" "src/lemonbuddy.cpp"