File CMakeLists.txt changed (mode: 100644) (index 4c732cb..a14918f) |
... |
... |
else() |
77 |
77 |
option(JRF_STATIC "Use jrf as static library instead of shared" ON) |
option(JRF_STATIC "Use jrf as static library instead of shared" ON) |
78 |
78 |
if (JRF_STATIC) |
if (JRF_STATIC) |
79 |
79 |
set(JRF_SHARED OFF) |
set(JRF_SHARED OFF) |
80 |
|
set(JRF_TARGETS jrf-static) |
|
81 |
80 |
else() |
else() |
82 |
81 |
set(JRF_SHARED ON) |
set(JRF_SHARED ON) |
83 |
|
set(JRF_TARGETS jrf-shared) |
|
84 |
82 |
endif() |
endif() |
85 |
83 |
endif() |
endif() |
86 |
84 |
|
|
87 |
85 |
if (JRF_SHARED) |
if (JRF_SHARED) |
88 |
86 |
add_library(jrf-shared SHARED ${SOURCE_FILES}) |
add_library(jrf-shared SHARED ${SOURCE_FILES}) |
|
87 |
|
list(APPEND TARGETS shared) |
89 |
88 |
list(APPEND JRF_TARGETS jrf-shared) |
list(APPEND JRF_TARGETS jrf-shared) |
90 |
89 |
endif() |
endif() |
91 |
90 |
if(JRF_STATIC) |
if(JRF_STATIC) |
92 |
91 |
add_library(jrf-static STATIC ${SOURCE_FILES}) |
add_library(jrf-static STATIC ${SOURCE_FILES}) |
|
92 |
|
list(APPEND TARGETS static) |
93 |
93 |
list(APPEND JRF_TARGETS jrf-static) |
list(APPEND JRF_TARGETS jrf-static) |
94 |
94 |
endif() |
endif() |
95 |
95 |
|
|
|
... |
... |
endif() |
101 |
101 |
|
|
102 |
102 |
set(EXPORT_NAME jrf-${PROJECT_VERSION}) |
set(EXPORT_NAME jrf-${PROJECT_VERSION}) |
103 |
103 |
|
|
104 |
|
foreach(TARGET ${JRF_TARGETS}) |
|
105 |
|
target_include_directories(${TARGET} PUBLIC |
|
|
104 |
|
foreach(TARGET ${TARGETS}) |
|
105 |
|
target_include_directories(jrf-${TARGET} PUBLIC |
106 |
106 |
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
107 |
107 |
$<INSTALL_INTERFACE:include/${EXPORT_NAME}> |
$<INSTALL_INTERFACE:include/${EXPORT_NAME}> |
108 |
108 |
) |
) |
109 |
|
target_link_libraries(${TARGET} PUBLIC jlib ${ZIP_LIB}) |
|
110 |
|
set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME jrf) |
|
|
109 |
|
target_link_libraries(jrf-${TARGET} PUBLIC jlib-${TARGET} ${ZIP_LIB}) |
|
110 |
|
set_target_properties(jrf-${TARGET} PROPERTIES OUTPUT_NAME jrf) |
111 |
111 |
|
|
112 |
|
target_compile_options(${TARGET} PRIVATE |
|
|
112 |
|
target_compile_options(jrf-${TARGET} PRIVATE |
113 |
113 |
$<$<CONFIG:DEBUG>:-O0;-g3;-ggdb> |
$<$<CONFIG:DEBUG>:-O0;-g3;-ggdb> |
114 |
114 |
$<$<CONFIG:RELEASE>:-O3> |
$<$<CONFIG:RELEASE>:-O3> |
115 |
115 |
$<$<CONFIG:RELWITHDEBINFO>:-O3;-g3;-ggdb> |
$<$<CONFIG:RELWITHDEBINFO>:-O3;-g3;-ggdb> |
116 |
116 |
) |
) |
117 |
|
target_compile_features(${TARGET} PUBLIC cxx_std_17) |
|
|
117 |
|
target_compile_features(jrf-${TARGET} PUBLIC cxx_std_17) |
118 |
118 |
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") |
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") |
119 |
|
target_compile_options(${TARGET} PRIVATE |
|
|
119 |
|
target_compile_options(jrf-${TARGET} PRIVATE |
120 |
120 |
-Weverything |
-Weverything |
121 |
121 |
-Wno-c++98-compat-pedantic |
-Wno-c++98-compat-pedantic |
122 |
122 |
-Wno-c++11-compat-pedantic |
-Wno-c++11-compat-pedantic |
|
... |
... |
foreach(TARGET ${JRF_TARGETS}) |
127 |
127 |
) |
) |
128 |
128 |
endif() |
endif() |
129 |
129 |
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") |
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") |
130 |
|
target_compile_options(${TARGET} PRIVATE -Wall -Wextra) |
|
|
130 |
|
target_compile_options(jrf-${TARGET} PRIVATE -Wall -Wextra) |
131 |
131 |
endif() |
endif() |
132 |
132 |
if (JRF_NATIVE) |
if (JRF_NATIVE) |
133 |
|
target_compile_options(${TARGET} PRIVATE -march=native) |
|
|
133 |
|
target_compile_options(jrf-${TARGET} PRIVATE -march=native) |
134 |
134 |
endif() |
endif() |
135 |
135 |
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" |
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" |
136 |
136 |
OR |
OR |
137 |
137 |
CMAKE_CXX_COMPILER_ID STREQUAL "GCC") |
CMAKE_CXX_COMPILER_ID STREQUAL "GCC") |
138 |
|
target_compile_options(${TARGET} |
|
|
138 |
|
target_compile_options(jrf-${TARGET} |
139 |
139 |
PRIVATE -fno-exceptions -fno-rtti -ffast-math |
PRIVATE -fno-exceptions -fno-rtti -ffast-math |
140 |
140 |
) |
) |
141 |
141 |
endif() |
endif() |
142 |
142 |
|
|
143 |
143 |
if (IS_TOP_LEVEL) |
if (IS_TOP_LEVEL) |
144 |
|
install(TARGETS ${TARGET} |
|
|
144 |
|
install(TARGETS jrf-${TARGET} |
145 |
145 |
DESTINATION lib |
DESTINATION lib |
146 |
|
EXPORT ${TARGET} |
|
|
146 |
|
EXPORT jrf-${TARGET} |
147 |
147 |
PUBLIC_HEADER DESTINATION include/${EXPORT_NAME} |
PUBLIC_HEADER DESTINATION include/${EXPORT_NAME} |
148 |
148 |
) |
) |
149 |
|
install(EXPORT ${TARGET} DESTINATION cmake/${EXPORT_NAME}) |
|
|
149 |
|
install(EXPORT jrf-${TARGET} DESTINATION cmake/${EXPORT_NAME}) |
150 |
150 |
endif() |
endif() |
151 |
151 |
endforeach() |
endforeach() |
152 |
152 |
|
|