2012-08-20 22:45:48 +04:00
|
|
|
project(ObjectLibraryA C)
|
2012-03-12 22:41:34 +04:00
|
|
|
# Add -fPIC so objects can be used in shared libraries.
|
2014-07-02 22:40:59 +04:00
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
2012-03-12 22:41:34 +04:00
|
|
|
|
2012-03-20 23:06:16 +04:00
|
|
|
add_definitions(-DA_DEF)
|
2012-03-12 22:41:34 +04:00
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT a1.c
|
2014-07-02 23:07:04 +04:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/a1.c.in
|
2012-03-12 22:41:34 +04:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/a1.c.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/a1.c
|
|
|
|
)
|
|
|
|
|
2014-07-02 23:38:10 +04:00
|
|
|
# Remove the custom command output to be sure it runs in an
|
2016-03-09 17:42:18 +03:00
|
|
|
# incremental test.
|
|
|
|
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/a.cmake)
|
2014-07-02 23:38:10 +04:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT a.cmake
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/a.cmake
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(A OBJECT a1.c a2.c a.cmake)
|
2013-02-08 22:12:45 +04:00
|
|
|
target_include_directories(A PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|