Suppose that I've got the following libraries:
add_library(myLib_static STATIC ${SRC_FILES})
add_library(myLib SHARED ${SRC_FILES})
# installing header files
install(FILES ${H_FILES} DESTINATION ${INSTDIRHEADER})
# installing binaries
install(TARGETS myLib_static
DESTINATION ${INSTDIRBIN})
install(TARGETS myLib
DESTINATION ${INSTDIRBIN})
If I execute the following command, both shared and static libraries will be installed:
make install
How can I have separate install commands for each of them? Something like this:
make install-static
make install-shared
Update:
Header files should also be installed when needed:
install(FILES ${H_FILES} DESTINATION ${INSTDIRHEADER})
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…