瀏覽代碼

Merge pull request #93 from SoapGentoo/fix-cmake

Fix cmake
Dalton Nell 6 年之前
父節點
當前提交
bbb735a11a
沒有帳戶連結到提交者的電子郵件
共有 2 個檔案被更改,包括 13 行新增27 行删除
  1. 13
    27
      CMakeLists.txt
  2. 二進制
      slop.1.gz

+ 13
- 27
CMakeLists.txt 查看文件

@@ -1,11 +1,15 @@
1 1
 cmake_minimum_required(VERSION 3.1.3)
2 2
 
3
+project(slop VERSION 7.3.49 LANGUAGES CXX)
4
+
3 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 9
 endif()
8 10
 
11
+include(GNUInstallDirs)
12
+
9 13
 # This should really never be disabled. The pure-X mode of slop is very expensive and buggy.
10 14
 # It also doesn't work on Wayland. Though if a system is never running a compositor, or
11 15
 # doesn't have OpenGL, this could remove some linking dependencies I suppose.
@@ -14,23 +18,11 @@ if ( SLOP_OPENGL )
14 18
   add_definitions(-DSLOP_OPENGL="True")
15 19
 endif()
16 20
 
17
-project(slop)
18
-
19 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 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 27
 # The names have to be unique unfortunately.
36 28
 set(EXECUTABLE_NAME "slop")
@@ -63,11 +55,13 @@ endif()
63 55
 
64 56
 set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
65 57
 set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD 11)
58
+set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_EXTENSIONS OFF)
66 59
 
67 60
 add_executable(${EXECUTABLE_NAME} src/main.cpp)
68 61
 
69 62
 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
70 63
 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 11)
64
+set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_EXTENSIONS OFF)
71 65
 
72 66
 set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules" )
73 67
 
@@ -118,15 +112,7 @@ else()
118 112
   endif()
119 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 )

二進制
slop.1.gz 查看文件