I am trying to organize goals in my subproject (in this case poco), but I have come to the conclusion that the properties cannot be changed for ALIAS purposes. I want the goals of my external project to be in their own folder, and not stretched everywhere in the project tree (say, a visual studio generator). Is there an easier way to add projects with my own properties?
So, instead of:
- CMakePredefinedTargets
- ALL_BUILD
- INSTALL
- ...
- MyTargets
- SomeLibrary
- SomeExe
- CppUnit
- Crypto
- Data
- ...
I want to:
- CMakePredefinedTargets
- ALL_BUILD
- INSTALL
- ...
- MyTargets
- SomeLibrary
- SomeExe
- Poco
- CppUnit
- Crypto
- Data
- ...
My attempt:
function(add_subdirectory_with_folder folder_name)
function(add_library name type)
_add_library(${ARGV})
set_target_properties(${name}
PROPERTIES
FOLDER "${folder_name}"
)
endfunction()
add_subdirectory(${ARGN})
endfunction()
# External Libs
add_subdirectory_with_folder("Poco" libs/poco)
Example target from poco library:
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
set_target_properties( "${LIBNAME}"
PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME}
DEFINE_SYMBOL JSON_EXPORTS
)
- , , . , IDE? , externalproject_add , , , . git -, , , .
EDIT:
, CMakeLists.txt , CMakeLists.txt, , , . , , visual studio, xcode . Linux, , , .