-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
59 lines (46 loc) · 1.72 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
58
59
cmake_minimum_required (VERSION 2.6)
project (samp-nodejs-plugin)
# Set vars
set(SRC_DIR ${CMAKE_SOURCE_DIR}/src)
set(INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
set(LIB_DIR ${CMAKE_SOURCE_DIR}/lib)
# Set include directories
include_directories("${INCLUDE_DIR}")
# Set defines
add_definitions(-DSUBHOOK_STATIC)
# Add additional source files
set(ADDITIONAL_SOURCE_FILES ${INCLUDE_DIR}/subhook/subhook.c)
# Add all source files
if(WIN32)
set(SRC_PATTERN ${SRC_DIR}/*.cpp ${SRC_DIR}/*.def ${SRC_DIR}/*.c ${ADDITIONAL_SOURCE_FILES})
else()
set(SRC_PATTERN ${SRC_DIR}/*.cpp ${SRC_DIR}/*.c ${ADDITIONAL_SOURCE_FILES})
endif()
file(GLOB_RECURSE SRC_FILES ${SRC_PATTERN})
# Link libraries
if(WIN32)
set(LIB_PATTERN ${LIB_DIR}/*.lib)
else()
set(LIB_PATTERN ${LIB_DIR}/*.a ${LIB_DIR}/*.so)
endif()
file(GLOB_RECURSE LIB_FILES ${LIB_PATTERN})
# Set outpout directory
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/plugins)
if(WIN32)
FOREACH(CONF ${CMAKE_CONFIGURATION_TYPES})
STRING(TOUPPER "${CONF}" CONF)
SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONF}" "${CMAKE_SOURCE_DIR}/bin/plugins")
SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF}" "${CMAKE_SOURCE_DIR}/bin/plugins")
IF(WIN32)
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${CMAKE_SOURCE_DIR}/bin/plugins")
ELSE()
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "$${CMAKE_SOURCE_DIR}/bin/plugins")
ENDIF()
ENDFOREACH()
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
SET (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
endif()
# Link libraries and create binary
add_library(samp-nodejs-plugin MODULE ${SRC_FILES})
target_link_libraries(samp-nodejs-plugin ${LIB_FILES})