瀏覽代碼

Align demo/CMakeLists.txt a bit more with with makefile_include.mk

Now, they build the same executables.
Richard Levitte 11 月之前
父節點
當前提交
6659f36ad6
共有 2 個文件被更改,包括 34 次插入10 次删除
  1. 30 10
      demos/CMakeLists.txt
  2. 4 0
      demos/small.c

+ 30 - 10
demos/CMakeLists.txt

@@ -3,6 +3,7 @@
 #-----------------------------------------------------------------------------
 option(BUILD_USEFUL_DEMOS "Build useful demos (hashsum)" FALSE)
 option(BUILD_USABLE_DEMOS "Build usable demos (ltcrypt sizes constants pem-info)" FALSE)
+option(BUILD_TEST_DEMOS "Build test demos (small tv_gen)" FALSE)
 
 #-----------------------------------------------------------------------------
 # Useful demos
@@ -10,7 +11,7 @@ option(BUILD_USABLE_DEMOS "Build usable demos (ltcrypt sizes constants pem-info)
 
 if(BUILD_USEFUL_DEMOS)
 
-    list(APPEND ALL_DEMOS_TARGETS hashsum tv_gen)
+    list(APPEND ALL_DEMOS_TARGETS hashsum)
 
     # hashsum
     add_executable(hashsum
@@ -21,15 +22,6 @@ if(BUILD_USEFUL_DEMOS)
         ${PROJECT_NAME}
     )
 
-    # tv_gen
-    add_executable(tv_gen
-        ${CMAKE_CURRENT_SOURCE_DIR}/tv_gen.c
-    )
-
-    target_link_libraries(tv_gen PRIVATE
-        ${PROJECT_NAME}
-    )
-
 endif()
 
 #-----------------------------------------------------------------------------
@@ -78,6 +70,34 @@ if(BUILD_USABLE_DEMOS)
 
 endif()
 
+#-----------------------------------------------------------------------------
+# Test demos
+#-----------------------------------------------------------------------------
+
+if(BUILD_TEST_DEMOS)
+
+    list(APPEND ALL_DEMOS_TARGETS tv_gen)
+
+    # small
+    add_executable(small
+        ${CMAKE_CURRENT_SOURCE_DIR}/small.c
+    )
+
+    target_link_libraries(small PRIVATE
+        ${PROJECT_NAME}
+    )
+
+    # tv_gen
+    add_executable(tv_gen
+        ${CMAKE_CURRENT_SOURCE_DIR}/tv_gen.c
+    )
+
+    target_link_libraries(tv_gen PRIVATE
+        ${PROJECT_NAME}
+    )
+
+endif()
+
 #-----------------------------------------------------------------------------
 # Install targets
 #-----------------------------------------------------------------------------

+ 4 - 0
demos/small.c

@@ -5,7 +5,11 @@
 
 int main(void)
 {
+#ifdef LTC_RIJNDAEL
+#ifdef ENCRYPT_ONLY
    register_cipher(&rijndael_enc_desc);
+#endif
+#endif
    register_prng(&yarrow_desc);
    register_hash(&sha256_desc);
    return 0;