Skip to content

Commit e54b851

Browse files
committed
FreeBSD build fixes.
1 parent c2b2314 commit e54b851

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

CMakeLists.txt

+17-4
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
124124
configure_file("${CMAKE_SOURCE_DIR}/cmake/cpack/${CMAKE_PROJECT_NAME}.desktop.in"
125125
"${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.desktop" @ONLY)
126126

127+
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
128+
set(FREEBSD TRUE)
129+
configure_file("${CMAKE_SOURCE_DIR}/cmake/cpack/${CMAKE_PROJECT_NAME}.desktop.in"
130+
"${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.desktop" @ONLY)
131+
127132
elseif(APPLE)
128133
if("${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "")
129134
message(STATUS "Build for macOS target: local version")
@@ -177,10 +182,14 @@ if (C_CLANG OR C_GCC)
177182
# It might go back in someday when I have more patience to clean up all the warnings.
178183
#
179184
###set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wvla -ffast-math -ftree-vectorize -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE ${EXTRA_FLAGS}")
180-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wvla -ffast-math -ftree-vectorize -D_GNU_SOURCE ${EXTRA_FLAGS}")
185+
if(FREEBSD)
186+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wvla -ffast-math -ftree-vectorize -D_DEFAULT_SOURCE ${EXTRA_FLAGS}")
187+
else()
188+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wvla -ffast-math -ftree-vectorize -D_GNU_SOURCE ${EXTRA_FLAGS}")
189+
endif()
181190
#
182191
#
183-
# -lm is needed for functins in math.h
192+
# -lm is needed for functions in math.h
184193
if (LINUX)
185194
# We have another problem with CentOS 6. clock_gettime() is in librt so we need -lrt.
186195
# The clock_* functions were moved into gnu libc for version 2.17.
@@ -214,7 +223,11 @@ else()
214223
set(INSTALL_DOC_DIR "share/doc/${CMAKE_PROJECT_NAME}")
215224
set(INSTALL_CONF_DIR "${INSTALL_DOC_DIR}/conf")
216225
set(INSTALL_SCRIPTS_DIR "${INSTALL_DOC_DIR}/scripts")
217-
set(INSTALL_MAN_DIR "share/man/man1")
226+
if(FREEBSD)
227+
set(INSTALL_MAN_DIR "man/man1")
228+
else()
229+
set(INSTALL_MAN_DIR "share/man/man1")
230+
endif()
218231
set(INSTALL_DATA_DIR "share/${PROJECT_NAME}")
219232
endif(WIN32 OR CYGWIN)
220233

@@ -297,7 +310,7 @@ add_subdirectory(doc)
297310
add_subdirectory(man)
298311

299312
# install desktop link
300-
if (LINUX)
313+
if (LINUX OR FREEBSD)
301314
install(FILES ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.desktop DESTINATION share/applications)
302315
install(FILES ${CMAKE_SOURCE_DIR}/cmake/cpack/${CMAKE_PROJECT_NAME}_icon.png DESTINATION share/pixmaps)
303316
endif()

0 commit comments

Comments
 (0)