Skip to content

Commit 2ecfddc

Browse files
AlexandraTrifanpcercuei
authored andcommitted
CMakeLists.txt: Add the option OSX_FRAMEWORK to control OSX builds.
On MacOS we should be able to build both frameworks and dylibs. Signed-off-by: Alexandra Trifan <[email protected]>
1 parent bc4c475 commit 2ecfddc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CMakeLists.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ if (NOT BUILD_SHARED_LIBS)
4343
add_definitions(-DLIBIIO_STATIC=1)
4444
endif()
4545

46-
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
46+
option(OSX_FRAMEWORK "Create a OSX_FRAMEWORK" ON)
47+
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND OSX_FRAMEWORK)
4748
option(OSX_PACKAGE "Create a OSX package" ON)
4849

4950
set(OSX_INSTALL_FRAMEWORKSDIR "/Library/Frameworks" CACHE STRING "Installation directory for frameworks")
@@ -474,7 +475,7 @@ add_library(iio ${LIBIIO_CFILES} ${LIBIIO_HEADERS} ${LIBIIO_EXTRA_HEADERS} ${LIB
474475
set_target_properties(iio PROPERTIES
475476
VERSION ${VERSION}
476477
SOVERSION ${LIBIIO_VERSION_MAJOR}
477-
FRAMEWORK TRUE
478+
FRAMEWORK ${OSX_FRAMEWORK}
478479
PUBLIC_HEADER ${LIBIIO_HEADERS}
479480
C_STANDARD 99
480481
C_STANDARD_REQUIRED ON
@@ -554,7 +555,7 @@ option(WITH_MAN "Generate on-line reference manuals (man pages)" OFF)
554555
add_subdirectory(man)
555556

556557
# Create an installer if compiling for OSX
557-
if(OSX_PACKAGE)
558+
if(OSX_PACKAGE AND OSX_FRAMEWORK)
558559
set(LIBIIO_PKG ${CMAKE_CURRENT_BINARY_DIR}/libiio-${VERSION}.g${LIBIIO_VERSION_GIT}.pkg)
559560
set(LIBIIO_TEMP_PKG ${CMAKE_CURRENT_BINARY_DIR}/libiio-${VERSION}-temp.pkg)
560561
set(LIBIIO_DISTRIBUTION_XML ${CMAKE_CURRENT_BINARY_DIR}/Distribution.xml)

tests/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ set_target_properties(${IIO_TESTS_TARGETS} iio_tests_helper PROPERTIES
7676
)
7777

7878
if(NOT SKIP_INSTALL_ALL)
79-
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
79+
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND OSX_FRAMEWORK)
8080
install(TARGETS ${IIO_TESTS_TARGETS} RUNTIME DESTINATION ${OSX_INSTALL_FRAMEWORKSDIR}/iio.framework/Tools)
8181
else()
8282
install(TARGETS ${IIO_TESTS_TARGETS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

0 commit comments

Comments
 (0)