forked from torch/paths
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
57 lines (46 loc) · 1.57 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 2.6)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}")
INCLUDE_DIRECTORIES("${LUA_INCDIR}")
LINK_DIRECTORIES("${LUA_LIBDIR}")
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckLibraryExists)
IF (UNIX OR NOT WIN32)
CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H)
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES(dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILES(time.h HAVE_TIME_H)
CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILES(sys/ndir.h HAVE_SYS_NDIR_H)
CHECK_INCLUDE_FILES(sys/utsname.h HAVE_SYS_UTSNAME_H)
CHECK_INCLUDE_FILES(sys/dir.h HAVE_SYS_DIR_H)
CHECK_INCLUDE_FILES(ndir.h HAVE_NDIR_H)
CHECK_FUNCTION_EXISTS(getcwd HAVE_GETCWD)
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_DLOPEN)
ENDIF (UNIX OR NOT WIN32)
CONFIGURE_FILE("paths.h.in" "${CMAKE_CURRENT_BINARY_DIR}/paths.h")
SET(src
"${CMAKE_CURRENT_SOURCE_DIR}/paths.c"
"${CMAKE_CURRENT_BINARY_DIR}/paths.h" )
SET(luasrc
"${CMAKE_CURRENT_SOURCE_DIR}/init.lua")
# When using MSVC
IF(MSVC)
# we want to respect the standard, and we are bored of those **** .
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE=1)
ENDIF(MSVC)
ADD_LIBRARY("paths" MODULE ${src})
SET_TARGET_PROPERTIES("paths" PROPERTIES
PREFIX "lib"
IMPORT_PREFIX "lib")
IF(APPLE)
SET_TARGET_PROPERTIES("paths" PROPERTIES
LINK_FLAGS "-undefined dynamic_lookup")
ENDIF()
INSTALL(FILES ${luasrc} DESTINATION ${LUADIR}/paths)
INSTALL(TARGETS paths
LIBRARY DESTINATION ${LIBDIR}
RUNTIME DESTINATION ${LIBDIR})
IF(LUALIB)
TARGET_LINK_LIBRARIES(paths ${LUALIB})
ENDIF()