Notes |
|
(0036159)
|
Brad King
|
2014-06-11 13:08
|
|
This is by design. The compilation of an OBJECT library is not influenced by its consumers. You can set the POSITION_INDEPENDENT_CODE target property on the OBJECT library. |
|
|
(0036160)
|
Nico Schlömer
|
2014-06-11 14:29
|
|
Hm, too bad. It's been quite comfortable not having to deal with specific flags needed for shared library objects.
Would you recommend to do
```
IF(BUILD_SHARED_LIBS)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF()
```
or is there an even better way to handle things? |
|
|
(0036161)
|
Brad King
|
2014-06-11 15:07
|
|
Re 0014968:0036160: That will work but it will also enable -fPIC on libraries that are explicitly marked STATIC. You could set it directly on the object library:
add_library(test2 OBJECT test2.c)
if(BUILD_SHARED_LIBS)
# These objects will be consumed by a shared library.
set_property(TARGET test2 PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
|
|
|
(0036162)
|
Nico Schlömer
|
2014-06-11 15:17
|
|
Ideally I'd want CMake to add `-fPIC` whenever it is necessary, but I guess I live with setting PIC globally ON.
Feel free to close. |
|
|
(0037564)
|
Robert Maynard
|
2015-01-05 08:38
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|