libwinpr-tools: start splitting makecert tool into library and executable
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Fri, 22 Mar 2013 20:36:44 +0000 (16:36 -0400)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Fri, 22 Mar 2013 20:36:44 +0000 (16:36 -0400)
winpr/tools/makecert/CMakeLists.txt
winpr/tools/makecert/cli/CMakeLists.txt [new file with mode: 0644]
winpr/tools/makecert/cli/main.c [new file with mode: 0644]
winpr/tools/makecert/makecert.c
winpr/tools/makecert/makecert.h [new file with mode: 0644]

index 33de8ce..2278495 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-set(MODULE_NAME "winpr-makecert")
-set(MODULE_PREFIX "WINPR_TOOLS_MAKECERT")
+set(MODULE_NAME "winpr-makecert-tool")
+set(MODULE_PREFIX "WINPR_MAKECERT_TOOL")
 
 set(${MODULE_PREFIX}_SRCS
-       makecert.c)
+       makecert.c
+       makecert.h)
 
 include_directories(${ZLIB_INCLUDE_DIRS})
 include_directories(${OPENSSL_INCLUDE_DIR})
 
-add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
+add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
 
 set(${MODULE_PREFIX}_LIBS
        ${ZLIB_LIBRARIES}
@@ -37,5 +38,8 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
 
 target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
 
+install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
+add_subdirectory(cli)
+
 set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Tools")
 
diff --git a/winpr/tools/makecert/cli/CMakeLists.txt b/winpr/tools/makecert/cli/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c2856a3
--- /dev/null
@@ -0,0 +1,33 @@
+# WinPR: Windows Portable Runtime
+# winpr-makecert cmake build script
+#
+# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set(MODULE_NAME "winpr-makecert")
+set(MODULE_PREFIX "WINPR_MAKECERT")
+
+include_directories(..)
+
+set(${MODULE_PREFIX}_SRCS
+       main.c)
+
+add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
+
+set(${MODULE_PREFIX}_LIBS winpr-makecert-tool)
+
+target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
+
+set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Tools")
+
diff --git a/winpr/tools/makecert/cli/main.c b/winpr/tools/makecert/cli/main.c
new file mode 100644 (file)
index 0000000..007b5ac
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * WinPR: Windows Portable Runtime
+ * makecert replacement
+ *
+ * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <winpr/crt.h>
+#include <winpr/cmdline.h>
+#include <winpr/sysinfo.h>
+
+#include "makecert.h"
+
+int main(int argc, char* argv[])
+{
+       return makecert_main(argc, argv);
+}
index ec750d0..eae4e8b 100644 (file)
 #include <openssl/applink.c>
 #endif
 
+#include "makecert.h"
+
+struct _MAKECERT_CONTEXT
+{
+       void* dummy;
+};
+
 X509* x509 = NULL;
 EVP_PKEY* pkey = NULL;
 char* output_file = NULL;
@@ -476,7 +483,7 @@ int command_line_pre_filter(void* context, int index, int argc, LPCSTR* argv)
        return 0;
 }
 
-int main(int argc, char* argv[])
+int makecert_main(int argc, char* argv[])
 {
        int status;
        DWORD flags;
diff --git a/winpr/tools/makecert/makecert.h b/winpr/tools/makecert/makecert.h
new file mode 100644 (file)
index 0000000..8fb0e70
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * WinPR: Windows Portable Runtime
+ * makecert replacement
+ *
+ * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MAKECERT_TOOL_H
+#define MAKECERT_TOOL_H
+
+#include <winpr/winpr.h>
+#include <winpr/wtypes.h>
+
+typedef struct _MAKECERT_CONTEXT MAKECERT_CONTEXT;
+
+int makecert_main(int argc, char* argv[]);
+
+#endif /* MAKECERT_TOOL_H */