cmake/Tests/ObjectLibrary/A/CMakeLists.txt

25 lines
776 B
CMake
Raw Normal View History

2013-03-16 19:13:01 +02:00
project(ObjectLibraryA C)
2012-04-19 19:04:21 +03:00
# Add -fPIC so objects can be used in shared libraries.
2015-04-27 22:25:09 +02:00
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
2012-04-19 19:04:21 +03:00
add_definitions(-DA_DEF)
add_custom_command(
OUTPUT a1.c
2015-04-27 22:25:09 +02:00
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/a1.c.in
2012-04-19 19:04:21 +03:00
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/a1.c.in
${CMAKE_CURRENT_BINARY_DIR}/a1.c
)
2015-04-27 22:25:09 +02:00
# Remove the custom command output to be sure it runs in an
2016-07-09 11:21:54 +02:00
# incremental test.
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/a.cmake)
2015-04-27 22:25:09 +02: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-03-16 19:13:01 +02:00
target_include_directories(A PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
2017-04-14 19:02:05 +02:00
set_property(TARGET A PROPERTY COMPILE_PDB_NAME Apdb)