Skip to content

Commit ff7d232

Browse files
committed
Build JEXEServer if we are a subproject
1 parent 75012ff commit ff7d232

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
1616

1717
include(OptimizeForArchitecture)
1818

19+
if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
20+
set(BUILD_SHARED_LIBS ON)
21+
endif()
22+
1923
set(CMAKE_C_STANDARD 11)
2024
set(CMAKE_C_STANDARD_REQUIRED ON)
2125
set(CMAKE_CXX_STANDARD 17)
@@ -70,8 +74,10 @@ add_subdirectory(base64)
7074
add_subdirectory(dllsrc)
7175
add_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()
7581
target_link_libraries(j PRIVATE j-blis j-openssl-sha j-sleef j-base64)
7682
if(WIN32)
7783
target_link_libraries(j PRIVATE j-dll)

dllsrc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
add_library(j-dll OBJECT)
2-
target_compile_definitions(j-dll PRIVATE _JDLL)
2+
target_compile_definitions(j-dll PRIVATE $<$<BOOL:BUILD_SHARED_LIBS>:_JDLL>)
33
target_compile_definitions(j-dll PRIVATE _CRT_SECURE_NO_WARNINGS)
44
set_target_properties(j-dll PROPERTIES EXCLUDE_FROM_ALL YES)
55
target_sources(j-dll PRIVATE

jsrc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ if(WIN32)
33
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
44
endif()
55

6-
add_library(j SHARED)
6+
add_library(j)
77
set_target_properties(j PROPERTIES CXX_VISIBILITY_PRESET hidden)
88
set_source_files_properties(aes-ni.c PROPERTIES COMPILE_FLAGS -maes)
99
target_sources(j PRIVATE

0 commit comments

Comments
 (0)