Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
64 lines (50 loc) · 1.63 KB
/
Copy pathCMakeLists.txt
File metadata and controls
64 lines (50 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# This file has no copyright assigned and is placed in the public domain.
# This file is the build script of the libwusers compatibility library:
# https://github.com/treeswift/libwusers
# No warranty is given; refer to the LICENSE file in the project root.
# Inspired by: https://github.com/krux02/minimal_cmake_example (public domain)
cmake_minimum_required(VERSION 3.2)
project(wusers)
set(liblibheaders
"include/wusers/wuser_types.h"
"include/wusers/wuser_cpage.h"
"include/wusers/wuser_eugid.h"
)
set(libapiheaders
"include/grp.h"
"include/pwd.h"
)
set(libheaders ${libapiheaders} ${liblibheaders})
set(libsources
"src/grp.cpp"
"src/pwd.cpp"
"src/wus.h"
"src/wus.cpp"
)
# Tuning:
# _WUSER_NO_HEURISTICS to bypass home folder search
set(compiledefs "SECURITY_WIN32")
if(MINGW)
# only affects the library & samples, not headers
set(compiledefs ${compiledefs} "ERRNO_IS_LVALUE")
endif()
if(MSVC)
set(compile_flags "/Wall")
else()
set(compile_flags "-fPIC" "-Wall")
endif()
include_directories(include)
add_library(wusers ${libheaders} ${libsources})
target_compile_options(wusers PRIVATE ${compile_flags})
target_compile_definitions(wusers PRIVATE ${compiledefs})
target_link_libraries(wusers -lnetapi32 -lkernel32 -ladvapi32 -lsecur32)
set(exesources "samples/wuserinfo.cpp")
add_executable(wuserinfo ${exesources})
target_link_libraries(wuserinfo wusers)
install(FILES ${liblibheaders} DESTINATION include/wusers)
install(FILES ${libapiheaders} DESTINATION include)
install(TARGETS wusers wuserinfo DESTINATION bin)
set(CPACK_PACKAGE_NAME "wusers")
set(CPACK_PACKAGE_VERSION "0.0.1")
set(CPACK_MONOLITHIC_INSTALL 1)
include(CPack)