File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
1616
1717include (OptimizeForArchitecture )
1818
19+ if (PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR )
20+ set (BUILD_SHARED_LIBS ON )
21+ endif ()
22+
1923set (CMAKE_C_STANDARD 11)
2024set (CMAKE_C_STANDARD_REQUIRED ON )
2125set (CMAKE_CXX_STANDARD 17)
@@ -70,8 +74,10 @@ add_subdirectory(base64)
7074add_subdirectory (dllsrc )
7175add_subdirectory (jsrc/openssl/sha )
7276
73- set_target_properties (j-blis j-openssl-sha j-sleef j-base64 PROPERTIES
74- POSITION_INDEPENDENT_CODE ON )
77+ if (BUILD_SHARED_LIBS )
78+ set_target_properties (j-blis j-openssl-sha j-sleef j-base64 PROPERTIES
79+ POSITION_INDEPENDENT_CODE ON )
80+ endif ()
7581target_link_libraries (j PRIVATE j-blis j-openssl-sha j-sleef j-base64 )
7682if (WIN32 )
7783 target_link_libraries (j PRIVATE j-dll )
Original file line number Diff line number Diff line change 11add_library (j-dll OBJECT )
2- target_compile_definitions (j-dll PRIVATE _JDLL )
2+ target_compile_definitions (j-dll PRIVATE $<$< BOOL : BUILD_SHARED_LIBS >: _JDLL > )
33target_compile_definitions (j-dll PRIVATE _CRT_SECURE_NO_WARNINGS )
44set_target_properties (j-dll PROPERTIES EXCLUDE_FROM_ALL YES )
55target_sources (j-dll PRIVATE
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ if(WIN32)
33 add_compile_definitions (_CRT_SECURE_NO_WARNINGS )
44endif ()
55
6- add_library (j SHARED )
6+ add_library (j )
77set_target_properties (j PROPERTIES CXX_VISIBILITY_PRESET hidden )
88set_source_files_properties (aes-ni.c PROPERTIES COMPILE_FLAGS -maes )
99target_sources (j PRIVATE
You can’t perform that action at this time.
0 commit comments