You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
717 B
18 lines
717 B
8 years ago
|
enable_language(C)
|
||
|
|
||
|
set(lib_dir ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
||
|
set(lib_link ${CMAKE_CURRENT_BINARY_DIR}/libLink)
|
||
|
set(lib_always ${CMAKE_CURRENT_BINARY_DIR}/libAlways)
|
||
|
file(MAKE_DIRECTORY ${lib_dir})
|
||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink lib ${lib_link})
|
||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink lib ${lib_always})
|
||
|
|
||
|
add_library(A SHARED A.c)
|
||
|
list(APPEND CMAKE_C_IMPLICIT_LINK_DIRECTORIES ${lib_dir})
|
||
|
set_property(TARGET A PROPERTY LIBRARY_OUTPUT_DIRECTORY ${lib_link})
|
||
|
|
||
|
add_executable(exe main.c)
|
||
|
target_link_libraries(exe A)
|
||
|
set_property(TARGET exe PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
||
|
set_property(TARGET exe PROPERTY BUILD_RPATH ${lib_always})
|