-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
56 lines (47 loc) · 2.65 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
# usage:
# mkdir build && cd build && cmake ..
# cmake --build . --config Release
# rebuild:
# cmake --build . --config Release --clean-first
cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0048 NEW)
project(tclftd2xx VERSION 1.2.0)
set (PKG_VERSION ${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR}${PROJECT_VERSION_PATCH})
set (PKG_DOT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Select the build type." FORCE)
endif(NOT CMAKE_BUILD_TYPE)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(LibFtd2xx REQUIRED)
find_package(TclStub REQUIRED)
set (TARGETNAME ${PROJECT_NAME}${PKG_VERSION})
add_library(${TARGETNAME} SHARED tclftd2xx.c tclftd2xx.rc)
include_directories(${TCL_INCLUDE_PATH})
include_directories(${LIBFTD2XX_INCLUDE})
target_link_libraries(${TARGETNAME} ${TCL_STUB_LIBRARY} ${LIBFTD2XX_LIBRARY})
if (MSVC)
add_definitions(-W3 -Ot -Oi -fp:strict -Gm- -Gs -GS -GL)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
target_link_libraries(${TARGETNAME} -ltcg)
endif(MSVC)
add_definitions(-DUNICODE -D_UNICODE -DUSE_TCL_STUBS)
add_definitions(-DPACKAGE_NAME="${PROJECT_NAME}")
add_definitions(-DPACKAGE_VERSION="${PKG_DOT_VERSION}")
add_definitions(-DCOMMAVERSION=${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},0)
add_definitions(-DDOTVERSION="${PKG_DOT_VERSION}")
add_definitions(-DVERSION="${PKG_VERSION}")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
# Perform the pkgIndex.tcl.in substitutions and copy to the output directory.
set (PACKAGE_NAME "ftd2xx")
set (PACKAGE_VERSION "${PKG_DOT_VERSION}")
set (PKG_LIB_FILE "${TARGETNAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
configure_file( pkgIndex.tcl.in pkgIndex.tcl @ONLY)
add_custom_command(TARGET ${TARGETNAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_BINARY_DIR}/pkgIndex.tcl" $<TARGET_FILE_DIR:${TARGETNAME}>)