Browse Source

Merge pull request #93 from SoapGentoo/fix-cmake

Fix cmake
Dalton Nell 6 years ago
parent
commit
bbb735a11a
No account linked to committer's email
2 changed files with 13 additions and 27 deletions
  1. 13
    27
      CMakeLists.txt
  2. BIN
      slop.1.gz

+ 13
- 27
CMakeLists.txt View File

1
 cmake_minimum_required(VERSION 3.1.3)
1
 cmake_minimum_required(VERSION 3.1.3)
2
 
2
 
3
+project(slop VERSION 7.3.49 LANGUAGES CXX)
4
+
3
 set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)")
5
 set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)")
4
 
6
 
5
-if ( NOT CMAKE_INSTALL_PREFIX )
6
-    set(CMAKE_INSTALL_PREFIX "/usr")
7
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
8
+  set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
7
 endif()
9
 endif()
8
 
10
 
11
+include(GNUInstallDirs)
12
+
9
 # This should really never be disabled. The pure-X mode of slop is very expensive and buggy.
13
 # This should really never be disabled. The pure-X mode of slop is very expensive and buggy.
10
 # It also doesn't work on Wayland. Though if a system is never running a compositor, or
14
 # It also doesn't work on Wayland. Though if a system is never running a compositor, or
11
 # doesn't have OpenGL, this could remove some linking dependencies I suppose.
15
 # doesn't have OpenGL, this could remove some linking dependencies I suppose.
14
   add_definitions(-DSLOP_OPENGL="True")
18
   add_definitions(-DSLOP_OPENGL="True")
15
 endif()
19
 endif()
16
 
20
 
17
-project(slop)
18
-
19
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
21
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
20
 
22
 
21
-set( CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Directory where man pages reside. (/usr/share/man, /usr/local/share/man, etc.)" )
22
-
23
-set( CMAKE_COMPRESS_MAN TRUE CACHE BOOL "Whether or not to compress the man pages for install." )
24
-
25
-if ( CMAKE_COMPRESS_MAN )
26
-    set( MANTARGET "slop.1.gz" )
27
-else()
28
-    set( MANTARGET "slop.1" )
29
-endif()
30
-
31
 include_directories("${PROJECT_BINARY_DIR}")
23
 include_directories("${PROJECT_BINARY_DIR}")
32
 
24
 
33
-add_definitions(-DSLOP_VERSION="v7.3.49")
25
+add_definitions(-DSLOP_VERSION="v${PROJECT_VERSION}")
34
 
26
 
35
 # The names have to be unique unfortunately.
27
 # The names have to be unique unfortunately.
36
 set(EXECUTABLE_NAME "slop")
28
 set(EXECUTABLE_NAME "slop")
63
 
55
 
64
 set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
56
 set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
65
 set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD 11)
57
 set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD 11)
58
+set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_EXTENSIONS OFF)
66
 
59
 
67
 add_executable(${EXECUTABLE_NAME} src/main.cpp)
60
 add_executable(${EXECUTABLE_NAME} src/main.cpp)
68
 
61
 
69
 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
62
 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
70
 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 11)
63
 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 11)
64
+set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_EXTENSIONS OFF)
71
 
65
 
72
 set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules" )
66
 set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules" )
73
 
67
 
118
   endif()
112
   endif()
119
 endif()
113
 endif()
120
 
114
 
121
-get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
122
-
123
-if ("${LIB64}" STREQUAL "TRUE")
124
-  set(LIBSUFFIX 64)
125
-else()
126
-  set(LIBSUFFIX "")
127
-endif()
128
-
129
-install( TARGETS ${EXECUTABLE_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" )
130
-install( TARGETS ${LIBRARY_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIBSUFFIX}" )
131
-install( FILES ${CMAKE_SOURCE_DIR}/src/slop.hpp DESTINATION "${CMAKE_INSTALL_PREFIX}/include" COMPONENT development )
132
-install( FILES "${CMAKE_SOURCE_DIR}/${MANTARGET}" DESTINATION  "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc )
115
+install( TARGETS ${EXECUTABLE_NAME} DESTINATION "${CMAKE_INSTALL_BINDIR}" )
116
+install( TARGETS ${LIBRARY_NAME} DESTINATION "${CMAKE_INSTALL_LIBDIR}" )
117
+install( FILES ${CMAKE_SOURCE_DIR}/src/slop.hpp DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT development )
118
+install( FILES ${CMAKE_SOURCE_DIR}/slop.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc )

BIN
slop.1.gz View File