Unverified Commit e1fbf15c authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #52

Fix XCode CMake generator issue
parents 5106b9f9 0570a448
...@@ -15,6 +15,11 @@ include(CheckCSourceRuns) # Check whether compiler produces binaries ...@@ -15,6 +15,11 @@ include(CheckCSourceRuns) # Check whether compiler produces binaries
include(GNUInstallDirs) # Sets default install paths include(GNUInstallDirs) # Sets default install paths
include(GenerateExportHeader) # Auto-generates dllexport macros include(GenerateExportHeader) # Auto-generates dllexport macros
# -- project-specific CMake settings -------------------------------------------
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# -- check whether we are running as CMake subdirectory ------------------------ # -- check whether we are running as CMake subdirectory ------------------------
get_directory_property(_parent PARENT_DIRECTORY) get_directory_property(_parent PARENT_DIRECTORY)
...@@ -206,22 +211,6 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") ...@@ -206,22 +211,6 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
"initialize the build configuration.") "initialize the build configuration.")
endif() endif()
# Set module path appropriately.
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Set binary output path if not defined by user.
if(EXECUTABLE_OUTPUT_PATH STREQUAL "")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/bin")
endif()
# Set library output path if not defined by user, but always set library output
# path to binary output path for Xcode projects.
if(CMAKE_GENERATOR STREQUAL "Xcode")
set(LIBRARY_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}")
elseif(LIBRARY_OUTPUT_PATH STREQUAL "")
set(LIBRARY_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/lib")
endif()
# -- get dependencies ---------------------------------------------------------- # -- get dependencies ----------------------------------------------------------
find_package(CAF COMPONENTS core io test) find_package(CAF COMPONENTS core io test)
......
// Some CMake generators (in particular XCode) choke on library targets that
// only consist of a TARGET_OBJECTS generator expression. Adding this otherwise
// useless file to the library target makes sure the generated project files
// have at least one regular source file.
namespace {
[[maybe_unused]] int dummy;
} // namespace
...@@ -22,7 +22,9 @@ set(CAF_BB_TEST_SOURCES ...@@ -22,7 +22,9 @@ set(CAF_BB_TEST_SOURCES
# #
# add_library(libcaf_bb_obj OBJECT ${CAF_BB_SOURCES} ${CAF_BB_HEADERS}) # add_library(libcaf_bb_obj OBJECT ${CAF_BB_SOURCES} ${CAF_BB_HEADERS})
# #
# add_library(libcaf_bb $<TARGET_OBJECTS:libcaf_bb_obj>) # add_library(libcaf_bb
# "${PROJECT_SOURCE_DIR}/cmake/dummy.cpp"
# $<TARGET_OBJECTS:libcaf_bb_obj>)
# #
# add_library(caf::bb ALIAS libcaf_bb) # add_library(caf::bb ALIAS libcaf_bb)
# #
......
...@@ -80,7 +80,9 @@ set(CAF_NET_TEST_SOURCES ...@@ -80,7 +80,9 @@ set(CAF_NET_TEST_SOURCES
add_library(libcaf_net_obj OBJECT ${CAF_NET_SOURCES} ${CAF_NET_HEADERS}) add_library(libcaf_net_obj OBJECT ${CAF_NET_SOURCES} ${CAF_NET_HEADERS})
add_library(libcaf_net $<TARGET_OBJECTS:libcaf_net_obj>) add_library(libcaf_net
"${PROJECT_SOURCE_DIR}/cmake/dummy.cpp"
$<TARGET_OBJECTS:libcaf_net_obj>)
add_library(caf::net ALIAS libcaf_net) add_library(caf::net ALIAS libcaf_net)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment