From 10aa9fb332149214aff4f9a35ddb8913f31ef58c Mon Sep 17 00:00:00 2001 From: asn Date: Tue, 19 Oct 2010 17:43:37 +0000 Subject: cmake: Make the osutil build complete. git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@1367 c9f7a03b-bd48-0410-a16d-cbbf54688b0b --- pki/base/osutil/CMakeLists.txt | 4 ++ pki/base/osutil/src/CMakeLists.txt | 17 +++---- .../osutil/src/com/netscape/osutil/CMakeLists.txt | 57 +++++++++++++++++++--- 3 files changed, 61 insertions(+), 17 deletions(-) (limited to 'pki/base/osutil') diff --git a/pki/base/osutil/CMakeLists.txt b/pki/base/osutil/CMakeLists.txt index 1b172af63..9fbb5ae59 100644 --- a/pki/base/osutil/CMakeLists.txt +++ b/pki/base/osutil/CMakeLists.txt @@ -1,3 +1,7 @@ project(osutil) +set(OSUTIL_LIBRARY_VERSION 1.2.0) +set(OSUTIL_LIBRARY_SOVERSION 1) + add_subdirectory(src) +add_subdirectory(src/com/netscape/osutil) diff --git a/pki/base/osutil/src/CMakeLists.txt b/pki/base/osutil/src/CMakeLists.txt index e3b074324..af864c7b8 100644 --- a/pki/base/osutil/src/CMakeLists.txt +++ b/pki/base/osutil/src/CMakeLists.txt @@ -1,7 +1,7 @@ project(osutil_java Java) -# this is ugly! -set(OSUTIL_JAVA_OBJECT_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}.dir/com/netscape/osutil/") +set(OSUTIL_JAVA_OBJECT_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/osutil.dir/" PARENT_SCOPE) +set(OSUTIL_JAR "${CMAKE_CURRENT_BINARY_DIR}/osutil.jar" CACHE INTERNAL "osutil jar file") set(osutil_java_SRCS com/netscape/osutil/LibC.java @@ -13,12 +13,11 @@ set(osutil_java_SRCS com/netscape/osutil/UserID.java ) -add_library(osutil_java ${osutil_java_SRCS}) +add_jar(osutil ${osutil_java_SRCS}) -set_target_properties(osutil_java - PROPERTIES - OUTPUT_NAME - osuitl +install( + FILES + ${OSUTIL_JAR} + DESTINATION + ${JAVA_JAR_INSTALL_DIR}/pki ) - -add_subdirectory(com/netscape/osutil) diff --git a/pki/base/osutil/src/com/netscape/osutil/CMakeLists.txt b/pki/base/osutil/src/com/netscape/osutil/CMakeLists.txt index 87b0d6b63..40cc674b8 100644 --- a/pki/base/osutil/src/com/netscape/osutil/CMakeLists.txt +++ b/pki/base/osutil/src/com/netscape/osutil/CMakeLists.txt @@ -1,6 +1,31 @@ -project(osutil_c C) +project(osutil_library C) -set(osutil_c_HDRS +set(OSUTIL_PUBLIC_INCLUDE_DIRS + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + CACHE INTERNAL "osutil public include directories" +) + +set(OSUTIL_PRIVATE_INCLUDE_DIRS + ${OSUTIL_PUBLIC_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR} + ${JNI_INCLUDE_DIRS} + ${NSPR_INCLUDE_DIRS} + ${NSS_INCLUDE_DIRS} +) + +set(OSUTIL_SHARED_LIBRARY + osutil_library + CACHE INTERNAL "osutil shared library" +) + +set(OSUTIL_LINK_LIBRARIES + ${NSPR_LIBRARIES} + ${NSS_LIBRARIES} + ${JNI_LIBRARIES} +) + +set(osutil_library_HDRS LIBC.h ResourceLimit.h Signal.h @@ -8,7 +33,7 @@ set(osutil_c_HDRS OSUtil.h ) -set(osutil_c_SRCS +set(osutil_library_SRCS LibC.c OSUtil.c ResourceLimit.c @@ -16,11 +41,11 @@ set(osutil_c_SRCS UserID.c ) -include_directories(${JNI_INCLUDE_DIRS} ${NSPR_INCLUDE_DIRS} ${NSS_INCLUDE_DIRS}) +include_directories(${OSUTIL_PRIVATE_INCLUDE_DIRS}) add_custom_command( OUTPUT - ${osutil_c_HDRS} + ${osutil_library_HDRS} COMMAND ${JAVA_HEADER} -classpath ${OSUTIL_JAVA_OBJECT_DIR} @@ -30,8 +55,24 @@ add_custom_command( com.netscape.osutil.Signal com.netscape.osutil.UserID com.netscape.osutil.OSUtil - DEPENDS - osutil_java ) -add_library(osutil SHARED ${osutil_c_HDRS} ${osutil_c_SRCS}) +add_library(${OSUTIL_SHARED_LIBRARY} SHARED ${osutil_library_HDRS} ${osutil_library_SRCS}) +target_link_libraries(${OSUTIL_SHARED_LIBRARY} ${OSUTIL_LINK_LIBRARIES}) +add_dependencies(${OSUTIL_SHARED_LIBRARY} osutil) + +set_target_properties(${OSUTIL_SHARED_LIBRARY} + PROPERTIES + VERSION + ${OSUTIL_LIBRARY_VERSION} + SOVERSION + ${OSUTIL_LIBRARY_SOVERSION} + OUTPUT_NAME + osutil +) + +install( + TARGETS + ${OSUTIL_SHARED_LIBRARY} + LIBRARY DESTINATION ${LIB_INSTALL_DIR} +) -- cgit