dbcf4b8a5f4a65578952325c4aa30aaf0fab1ba5
[platform/upstream/cmake.git] / Tests / RunCMake / AutoExportDll / AutoExport.cmake
1 project(autoexport)
2 set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
3 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${autoexport_BINARY_DIR}/bin)
4 add_subdirectory(sub)
5 add_library(objlib OBJECT objlib.c)
6 set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1)
7 add_library(autoexport SHARED hello.cxx world.cxx foo.c $<TARGET_OBJECTS:objlib>)
8 add_library(autoexport3 SHARED cppCLI.cxx)
9 if(MSVC AND NOT MSVC_VERSION VERSION_LESS 1600
10   AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
11   set_property(TARGET autoexport3 PROPERTY COMMON_LANGUAGE_RUNTIME "")
12 endif()
13
14 add_executable(say say.cxx)
15 if(MSVC)
16   set_target_properties(say PROPERTIES ENABLE_EXPORTS ON)
17   add_library(autoexport_for_exec SHARED hello2.c)
18   target_link_libraries(autoexport_for_exec say)
19   if(NOT MSVC_VERSION VERSION_LESS 1600 AND
20     NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
21     enable_language(ASM_MASM)
22     target_sources(autoexport PRIVATE nop.asm)
23     set_property(SOURCE nop.asm PROPERTY COMPILE_FLAGS /safeseh)
24     target_compile_definitions(say PRIVATE HAS_JUSTNOP)
25   endif()
26 endif()
27 target_link_libraries(say autoexport autoexport2 autoexport3)