CMake의 Source와 Build를 나누겠다는 철학을 받아 전에 만든 CMakeLists.txt를 변경하였다.
이전버전
이전버전
cmake_minimum_required(VERSION 2.8) project(myproject_certs) set(CERT_TARGET myproject_certs) add_custom_command(OUTPUT privatekey.key COMMAND openssl genrsa -passout pass:1111 -des3 -out privatekey.key 1024 2> /dev/null COMMENT "${CERT_TARGET}: Generating privatekey" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) add_custom_command(OUTPUT privatekey.pem COMMAND openssl rsa -passin pass:1111 -in ${CMAKE_CURRENT_BINARY_DIR}/privatekey.key -out ${CMAKE_CURRENT_BINARY_DIR}/privatekey.pem 2> /dev/null COMMENT "${CERT_TARGET}: Convert privatekey to PEM style" DEPENDS privatekey.key WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) add_custom_command(OUTPUT certificate.pem COMMAND openssl req -batch -utf8 -new -x509 -nodes -sha1 -days 365 -key ${CMAKE_CURRENT_BINARY_DIR}/privatekey.pem -out ${CMAKE_CURRENT_BINARY_DIR}/certificate.pem 2> /dev/null COMMENT "${CERT_TARGET}: Generating self-signed certificate" DEPENDS privatekey.pem WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) add_custom_command(OUTPUT intermediate.pem COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/certificate.pem ${CMAKE_CURRENT_BINARY_DIR}/intermediate.pem 2> /dev/null COMMENT "${CERT_TARGET}: Generating intermediate cert" DEPENDS certificate.pem WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) add_custom_target(${CERT_TARGET} ALL DEPENDS intermediate.pem WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
댓글
댓글 쓰기