AutoExport.cmake 587 B

123456789101112131415
  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_executable(say say.cxx)
  9. if(MSVC)
  10. set_target_properties(say PROPERTIES ENABLE_EXPORTS ON)
  11. add_library(autoexport_for_exec SHARED hello2.c)
  12. target_link_libraries(autoexport_for_exec say)
  13. endif()
  14. target_link_libraries(say autoexport autoexport2)