cmake_minimum_required(VERSION 2.8)
project(jwm-menu CXX C)
set(PROJECT_NAME jwm-menu)
set(VERSION "2.0.0")
set(DATE "Nov 05, 2015")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
set(SHORT_DESC "create menus for JWM easily")
set(LONG_DESC "A tool to easily create menus for JWM easily")
set(AUTHOR "israeldahl")
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
     message( FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt." )
endif()
set(EXAMPLES "If using the binary compiled menus you will have an XDG menu
.BR You can edit the jwm-applications.menu file to change the order of items, etc..
.BR If you are using the script based menus you must instead modify the script as you require
.BR Include the binary menu /usr/bin/jwm-menu OR /usr/bin/jwm-places
.BR <RootMenu onroot=\"3\">
.BR    <Include>exec:/usr/bin/jwm-menu</Include>
.BR    <!-- OR -->
.BR    <Include>exec:/usr/bin/jwm-places</Include>
.BR    <!-- you can add custom menu entries below -->
.BR </RootMenu>
.BR FOR SCRIPT MENUS
.BR <RootMenu onroot=\"3\">
.BR   <Include>/usr/bin/jwm-menu-bash</Include>
.BR   <!-- you can add custom menu entries below -->
.BR </RootMenu> ")
include(AddFileDependencies)
include(CheckIncludeFiles)
include(FindPkgConfig)
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/src")
set(XML_HEADERS include/pugixml.hpp)
set(XML_SOURCES ${HEADERS} src/pugixml.cpp)
set(MENU_SRCS src/common.cpp ${XML_SOURCES})
add_library(jwmmenu STATIC ${MENU_SRCS})
## install things in /usr
set(CMAKE_INSTALL_PREFIX "/usr")
file(RELATIVE_PATH LIB_DIR_RELATIVE "/${BIN_DIR}" "/${LIB_DIR}")
#Configure Man page
#configure_file("debian/${PROJECT_NAME}.1.in" "${PROJECT_NAME}.1")
#set(CMAKE_BUILD_TYPE "RELEASE")
#set(CMAKE_CONFIGURATION_TYPE "RELEASE")
## Compiler flags
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g -fvar-tracking -DDEBUG=true -DCOMMON_XMLOUT=true")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -finline-small-functions -ffunction-sections -fdata-sections -fmerge-all-constants -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -Os -std=c++0x -finline-functions-called-once -s -DQUIET_ERROR=true")
add_executable(jwm-menu src/menuXDG-alt.cxx)
add_executable(jwm-places src/places.cpp)
TARGET_LINK_LIBRARIES(jwm-menu jwmmenu)
TARGET_LINK_LIBRARIES(jwm-places jwmmenu)
## install the man file
#install(FILES jwm-menu.1 DESTINATION share/man/man1/ PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
install(TARGETS jwm-menu jwm-places jwmmenu RUNTIME DESTINATION bin ARCHIVE DESTINATION lib)
