File: AutoExport.cmake

package info (click to toggle)
cmake 3.25.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 121,376 kB
  • sloc: ansic: 361,053; cpp: 250,806; sh: 3,828; yacc: 3,243; python: 2,707; lex: 1,328; lisp: 382; asm: 371; f90: 314; java: 266; perl: 217; objc: 212; xml: 202; cs: 200; fortran: 131; makefile: 99; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (27 lines) | stat: -rw-r--r-- 1,120 bytes parent folder | download
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
project(autoexport)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${autoexport_BINARY_DIR}/bin)
add_subdirectory(sub)
add_library(objlib OBJECT objlib.c)
set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1)
add_library(autoexport SHARED hello.cxx world.cxx foo.c $<TARGET_OBJECTS:objlib>)
add_library(autoexport3 SHARED cppCLI.cxx)
if(MSVC AND NOT MSVC_VERSION VERSION_LESS 1600
  AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
  set_property(TARGET autoexport3 PROPERTY COMMON_LANGUAGE_RUNTIME "")
endif()

add_executable(say say.cxx)
if(MSVC)
  set_target_properties(say PROPERTIES ENABLE_EXPORTS ON)
  add_library(autoexport_for_exec SHARED hello2.c)
  target_link_libraries(autoexport_for_exec say)
  if(NOT MSVC_VERSION VERSION_LESS 1600 AND
    NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
    enable_language(ASM_MASM)
    target_sources(autoexport PRIVATE nop.asm)
    set_property(SOURCE nop.asm PROPERTY COMPILE_FLAGS /safeseh)
    target_compile_definitions(say PRIVATE HAS_JUSTNOP)
  endif()
endif()
target_link_libraries(say autoexport autoexport2 autoexport3)