-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
28 lines (22 loc) · 909 Bytes
/
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
cmake_minimum_required(VERSION 3.0)
project(sharedLibs)
# Export no symbols by default (if the compiler supports it).
# This makes e.g. GCC's "visibility behavior" consistent with MSVC's.
# On Windows/MSVC this is a noop.
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
# Always include the source and build directories in the include path.
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# create the executable
add_executable(main main.cpp)
# create the shared library
add_library(shared SHARED shared.cpp)
# generate export header automatically
include (GenerateExportHeader)
GENERATE_EXPORT_HEADER(shared
BASE_NAME shared
EXPORT_MACRO_NAME SHARED_EXPORT
EXPORT_FILE_NAME shared_EXPORTS.h
STATIC_DEFINE SHARED_EXPORTS_BUILT_AS_STATIC)
# link our executable "main" with the shared library "shared"
target_link_libraries(main shared)