File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,20 @@ set(docopt_HEADERS
39
39
#============================================================================
40
40
# Compile targets
41
41
#============================================================================
42
- add_library (docopt_o OBJECT ${docopt_SOURCES} ${docopt_HEADERS} )
43
- set_target_properties (docopt_o PROPERTIES POSITION_INDEPENDENT_CODE TRUE )
44
-
45
- add_library (docopt SHARED $< TARGET_OBJECTS:docopt_o> )
46
- add_library (docopt_s STATIC $< TARGET_OBJECTS:docopt_o> )
42
+ if (XCODE )
43
+ # Xcode does not support libraries with only object files as sources.
44
+ # See https://cmake.org/cmake/help/v3.0/command/add_library.html?highlight=add_library
45
+ add_library (docopt SHARED ${docopt_SOURCES} ${docopt_HEADERS} )
46
+ add_library (docopt_s STATIC ${docopt_SOURCES} ${docopt_HEADERS} )
47
+ else ()
48
+ # If not using Xcode, we will create an intermediate object target to avoid
49
+ # compiling the source code twice.
50
+ add_library (docopt_o OBJECT ${docopt_SOURCES} ${docopt_HEADERS} )
51
+ set_target_properties (docopt_o PROPERTIES POSITION_INDEPENDENT_CODE TRUE )
52
+
53
+ add_library (docopt SHARED $< TARGET_OBJECTS:docopt_o> )
54
+ add_library (docopt_s STATIC $< TARGET_OBJECTS:docopt_o> )
55
+ endif ()
47
56
48
57
target_include_
3F16
directories (docopt PUBLIC $< BUILD_INTERFACE:${PROJECT_SOURCE_DIR} > $< INSTALL_INTERFACE:include/docopt> )
49
58
target_include_directories (docopt_s PUBLIC $< BUILD_INTERFACE:${PROJECT_SOURCE_DIR} > $< INSTALL_INTERFACE:include/docopt> )
You can’t perform that action at this time.
0 commit comments