I used CMake to compile a framework into three different .lib files, and one .sln file. The project is structured as such
UeiDaqFramework
|-CMakeLists.txt
|-build
| |-Framework_static.sln
| | - other cmake files and stuff
|-UeiDaqCore
| |-CMakeLists.txt
| |-source code for this subproject
|-UeiSimuDriver
| |-CMakeLists.txt
| |-source code for this subproject
|-UeiPDNADriver
| |-CMakeLists.txt
| |-source code for this subproject
|
|-Output
|-UeiDaqCore.lib
|-UeiSimuDriver.lib
|-UeiPDNADriver.lib
My test code require a Framework_static.lib in its include file instead of a .sln file, and I do not know how to combine the three existing .lib files using cmake. I did attempt to follow what this CMake - combine multiple libraries into one answer suggested, by just building all the source files into a single library, but I'm new to CMake, and it did not work. Here is the CmakeLists.txt file at the top directory of my project.
cmake_minimum_required(VERSION 3.13.0 FATAL_ERROR)
set(CMAKE_SYSTEM_VERSION CACHE TYPE INTERNAL FORCE)
project(Framework_static_vc15)
################################################################################
# Set target arch type if empty. Visual studio solution generator provides it.
################################################################################
if(NOT CMAKE_VS_PLATFORM_NAME)
set(CMAKE_VS_PLATFORM_NAME "x64")
endif()
message("${CMAKE_VS_PLATFORM_NAME} architecture in use")
if(NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32"))
message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!")
endif()
################################################################################
# Global configuration types
################################################################################
set(CMAKE_CONFIGURATION_TYPES
"Debug"
"Release"
CACHE STRING "" FORCE
)
################################################################################
# Global compiler options
################################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
endif()
################################################################################
# Global linker options
################################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_EXE_LINKER_FLAGS "")
set(CMAKE_MODULE_LINKER_FLAGS "")
set(CMAKE_SHARED_LINKER_FLAGS "")
set(CMAKE_STATIC_LINKER_FLAGS "")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS}")
endif()
################################################################################
# Nuget packages function stub.
################################################################################
function(use_package TARGET PACKAGE VERSION)
message(WARNING "No implementation of use_package. Create yours.")
endfunction()
################################################################################
# Common utils
################################################################################
include(CMake/Utils.cmake)
################################################################################
# Additional Global Settings(add specific info there)
################################################################################
include(CMake/GlobalSettingsInclude.cmake OPTIONAL)
################################################################################
# Use solution folders feature
################################################################################
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
################################################################################
# Sub-projects
################################################################################
add_subdirectory(Source/UeiDaqCore)
add_subdirectory(Source/UeiPDNADriver)
add_subdirectory(Source/UeiSimuDriver)
These CMakeLists.txt files were generated automatically by a generator that takes a visual studio .sln file and converts it to a .txt tree. Heres the link to the converter if anyone is interested. https://cmakeconverter.readthedocs.io/en/develop/intro.html
Im not sure if I need to rewrite Just the top level .txt file, or if I need to rewrite all the CMakeLists.txt files. Any help would be appreciated.
I assume the build of the shared libs is within the subdirectories, because your CMakeLists.txt does not contain any add_library command.
To get a static library containing all sources you have to
Collect all sources
Add command to build the static library
For 1. add the following to every subdir/CMakeLists.txt
set(SOURCES # This creates a list of sources called SOURCES
myFileA.cpp # This adds an item to the list
myFileB.cpp
${SOURCES} # This adds all items of existing list SOURCES to the current list
PARENT_SCOPE # This makes SOURCES visible in the parent CMakeLists.txt
)
For 2. add the static library
add_library(myTestLib_static.c STATIC ${SOURCES})
Related
I am trying to make node.js native addon which use cmake to compile c++ code...
CMakeLists.txt file
cmake_minimum_required(VERSION 3.15)
# Name of the project (will be the name of the plugin)
project (addon)
set(CMAKE_CXX_STANDARD 11)
# Don't add this line if you will try_compile with boost.
# set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED OFF)
set(Boost_USE_STATIC_RUNTIME ON)
find_package(Boost)
# Essential include files to build a node addon,
# you should add this line in every CMake.js based project.
include_directories(${CMAKE_JS_INC} ${Boost_INCLUDE_DIRS})
# Declare the location of the source files
file(GLOB SOURCE_FILES "src/*.cpp" "src/*.h")
# This line will tell CMake that we're building a shared library
# from the above source files
# named after the project's name
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})
# This line will give our library file a .node extension without any "lib" prefix
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
# Essential library files to link to a node addon,
# you should add this line in every CMake.js based project.
target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB} ${Boost_LIBRARIES})
# Include N-API wrappers
execute_process(COMMAND node -p "require('node-addon-api').include"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE NODE_ADDON_API_DIR
)
string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${NODE_ADDON_API_DIR})
add_definitions(-DNAPI_VERSION=3)
I am using websocketpp library which is internally dependent on boost
And while compiling I am getting this error:
LINK : fatal error LNK1104: cannot open file 'libboost_random-vc142-mt-x64-1_74.lib' [C:\Users\atiqg\Desktop\Tom\muteme\shells\electron\na
tive_module\build\addon.vcxproj]
libboost_random-vc142-mt-x64-1_74.lib is present in boost_1_71_0/stage/x64/lib folder
And this path is added in environments variables too....
Well, I am new to CMake.
I have the following file structure
haze_removal
|---build
|---bin
| |--Test
| |--CMakeLists.txt
|---lib
| |--libtools.so
|---include
| |--tools.hpp
|---test
| |--main.cpp
| |--CMakeLists.txt
|---src
| |--tools.cpp
| |--CMakeLists.txt
|---CMakeLists.txt
The libtools.so is builded from ../src/tools.cpp. I build the whole project in ../build using the following cmake command:
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
The Test is build from ../test/main.cpp
I build this project successfully. But when I debug Test using gdb ./Test, I can't skip in the function that from libtools.so.
These are my CMakeLists.txt from different directories.
CMakeLists.txt under haze_removal/
cmake_minimum_required(VERSION 2.8)
project(haze_removal)
# find needed package
find_package(OpenCV REQUIRED)
# library directory
add_subdirectory(src)
# test
add_subdirectory(test)
CMakeLists.txt under ../src/
# generate dynamic library
# add source file, include directories
aux_source_directory(. TOOLS_SRC)
include_directories(${PROJECT_SOURCE_DIR}/include)
# generate
add_library(tools SHARED ${TOOLS_SRC})
# set output directory and lib's name
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set_target_properties(tools PROPERTIES OUTPUT_NAME "tools")
# link library
target_link_libraries(tools ${OpenCV_LIBS})
CMakeLists.txt under ../test/
# add source file, include directories, link directories
aux_source_directory(. EXE_SRC)
include_directories(${PROJECT_SOURCE_DIR}/include)
link_directories(${PROJECT_SOURCE_DIR}/lib)
# generate
add_executable(Test ${EXE_SRC})
# set output directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
# link libraries
target_link_libraries(Test ${OpenCV_LIBS} libtools.so)
My question is how I can debug the functions that from libtools.
Well, I find that why I can't step in the dynamic library even though I set CMAKE_BUILD_TYPE=Debug. Because before I set the build model to Debug I used to set CMAKE_BUILD_TYPE=Release. After I change the build model, I didn't delete the files in the build directory.
I don't know whether the above explanation is right or not, but I do solve my problem.
Thx!
I have seen a lot of similar questions and answers, but until now it seems not so obvious to get it working. I am quite new to CMake and until now everything was easy except the integration with protocol buffers.
I have a project with subdirectories, where each subdirectory has its own CMakeLists.txt
One of the subdirectory contains a .proto file. If the PROTOBUF_GENERATE_CPP macro is executed it generates the sources and the headers files. This macro is invoked from the CMakeLists.txt in the subdirectory containing the .proto file.
It seems however the make file is not invoked because no sources are added to the target. I can not add the sources to the target, because the files do not exist, they exist after generation, so this results in an error when CMake runs.
Setting the file properties to generated seems also not to help. In general, before the build process starts the macro should have been run to generated the source files.
How to do this, any working examples ?
Example:
./src/externals/protodef (from other repository, only contains .proto files)
./src/generated (supposed for the generated c and header files by protoc)
CMakeLists-1 (project root)
cmake_minimum_required (VERSION 2.6)
PROJECT (prototest)
ADD_SUBDIRECTORY("${PROJECT_SOURCE_DIR}/src/externals/protodef")
ADD_SUBDIRECTORY("${PROJECT_SOURCE_DIR}/src")
SET_SOURCE_FILES_PROPERTIES(${PROTO_SOURCES} ${PROTO_HEADERS} PROPERTIES GENERATED TRUE)
ADD_EXECUTABLE(prototest ${PROTO_SOURCES} ${SOURCE} )
TARGET_LINK_LIBRARIES(prototest ${EXTERNAL_LIBS} )
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
CMakeLists-2 (src)
SET(SOURCE ${SOURCE}
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
PARENT_SCOPE
)
CMakeLists-3 (src/externals/protodef)
SET(PROTOBUF_PATH "D:/protobuf-3.0.0/" )
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${PROTOBUF_PATH}")
# Changing PROTO_SRCS and PROTO_HDRS does not work for setting the location
# of the generated files.
# Those variable are ignored by CMake for compiling the proto files.
# Using a dedicated CMakeLists.txt and settng CURRENT_BINARY dir is a
# workaround to get them where we want.
SET(GENERATED_DIR ${PROJECT_SOURCE_DIR}/src/generated )
SET(CMAKE_CURRENT_BINARY_DIR ${GENERATED_DIR} )
INCLUDE(FindProtobuf)
FIND_PACKAGE(Protobuf REQUIRED)
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS${CMAKE_CURRENT_SOURCE_DIR}/test1.proto)
SET( EXTERNAL_LIBS ${PROTOBUF_PATH}/lib/libprotobuf.a PARENT_SCOPE)
# Propagate sources to the parant project
SET(PROTO_SOURCES ${PROTO_SRCS}
PARENT_SCOPE
)
SET(PROTO_HEADERS ${PROTO_HDRS}
PARENT_SCOPE
)
First generate the protobuf files, then add them to a CMake target.
CMakeLists (src) :
# Generate h/cpp proto files (./src/externals/protodef) into ./src/generated folder
PROTOBUF_GENERATE_CPP(...)
# Process subdir
ADD_SUBDIRECTORY(generated)
It seems that PROTOBUF_GENERATE_CPP can only be used in the same subdirectory. A possible workaround is to invoke protoc directly instead :
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/externals/protodef PROTOMODEL_PATH)
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/generated PROTOBINDING_PATH)
FILE(GLOB DATAMODEL_PROTOS "${CMAKE_CURRENT_SOURCE_DIR}/externals/protodef/*.proto")
FOREACH(proto ${DATAMODEL_PROTOS})
FILE(TO_NATIVE_PATH ${proto} proto_native)
EXECUTE_PROCESS(COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --proto_path=${PROTOMODEL_PATH} --cpp_out=${PROTOBINDING_PATH} ${proto_native}
RESULT_VARIABLE rv)
# Optional, but that can show the user if something have gone wrong with the proto generation
IF(${rv})
MESSAGE("Generation of data model returned ${rv} for proto ${proto_native}")
ENDIF()
ENDFOREACH(proto)
CMakeLists (src/generated) :
## List generated sources files
FILE(GLOB HDRS "*.h")
FILE(GLOB SRCS "*.cc")
ADD_LIBRARY(protoBinding ${HDRS} ${SRCS})
# ${PROTOBUF_LIBRARIES} should be defined by FIND_PACKAGE(Protobuf REQUIRED)
TARGET_LINK_LIBRARIES(protoBinding ${PROTOBUF_LIBRARIES})
This way CMake will first generate the header/source files, and only then add the generated files to a CMake target.
You can then use protoBinding target to link the generated files to an other target (e.g at the end of src's CMakeLists.txt) :
ADD_LIBRARY(myModel ${myFiles})
TARGET_LINK_LIBRARIES(myModel protoBinding)
I have cli wrapper function which i am trying to configure in cmake. After i generate the project with cmake the generated .proj file does not have the property of clr support is set to no common languaage runtime support. below is my cmake file
# This is the root ITK CMakeLists file.
cmake_minimum_required(VERSION 2.8.9)
if(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0003 NEW)
endif()
set_target_properties(${TargetName} PROPERTIES COMPILE_FLAGS "/clr")
SET(LINK_LIBRARIES
D:\\2016\\RandomSlicing\\Processing\\lib\\obliquePlane.lib
)
# The header files
SET(HEADERS
ObliquePlaneWrapper.h
obliquePlane.h
)
# The implementation files
SET(SOURCES
ObliquePlaneWrapper.cpp
)
# Find ITK.
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
# Add this as include directory
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${SOURCE_PATH}
${VXL_INCLUDE_DIRS}
)
# Main library
#ADD_EXECUTABLE(obliquePlane ${HEADERS} ${SOURCES})
ADD_LIBRARY(ObliquePlaneWrapper SHARED ${HEADERS} ${SOURCES})
TARGET_LINK_LIBRARIES(ObliquePlaneWrapper ${LINK_LIBRARIES} ${ITK_LIBRARIES})
I manually set this property in the All_build project and the corresponding .proj file. When i build the project it is searching for the ObliquePlaneWrapper.dll which it should be generating. Is this a problem because of some flag not set for common language runtime support
You can manually supply Compile Flags to specific sources to be compiled with specific flags. This includes \CLR for Visual C++. See example here.
https://cmake.org/pipermail/cmake/2011-April/043773.html
I have a large, modular CMake project.
Some modules are static libraries, some are executables that may or may not use some of these libraries. I already have a system of requirement/dependency checking in place that would stop cmake and tell the user if he's trying to build an executable but not the library that it requires.
The project compiles fine as is. I would like to split this into subprojects, i.e. set project(${module_name}) for each of the modules' CMakeLists.txt. Unfortunately, as soon as I insert this line into the apppropriate macro, I immediately get linker errors, i.e. the executables can no longer see the symbols defined in the static libraries.
The c++ command (I happen to be using gcc 4.8) that is invoked on the executables is unchanged, so something else must be different. How can I fix this and retain the subproject structure?
EDIT: per #Gerald's comment, additional information.
Project folder structure:
root
|
|-bin
|-lib
|-cmake(various CMake scripts, added to module path)
|-third_party
|-...
|-CMakeLists.txt
|-modules(top-level module directory, expanded)
|
|-CMakeLists.txt
|-exec_module_a
|-exec_module_b
|-... (other exec modules)
|-lib_module_a
|-lib_module_b
|- ... (other lib modules)
|-lib_module_N (expanded)
|
|-CMakeLists.txt
|-include/root/module_N (various include files)
|-src (various source files)
|-tests
Structure of a typical leaf-level CMakeLists.txt (same but one arg. to root_add_subproject for both lib and exec modules):
include(RootUtils)
set(module_name ${EXEC_MODULE_A})
#---------------------------CHECK REQUIREMENTS---------------------------------#
root_check_module_requirements(module_name
BUILD_${LIB_MODULE_A}
BUILD_${LIB_MODULE_G}
#...
WITH_QT
WITH_THIRD_PARTY_BLAH1
WITH_THIRD_PARTY_BLAH2
#...
)
#---------------------------ADD SOURCES AND TARGET-----------------------------#
root_add_subproject(${module_name} executable qt_on)
#---------------------------ADD INCLUDES---------------------------------------#
target_include_directories(${TARGET_NAME} PUBLIC
#third-party includes
${THIRD_PARTY_BLAH1_INCLUDE_DIRS}
${THIRD_PARTY_BLAH1_INCLUDE_DIRS}
#...
#module includes
"${MODULES_DIR}/${LIB_MODULE_A}/include"
"${MODULES_DIR}/${LIB_MODULE_B}/include"
#...
)
#---------------------------LINK LIBRARIES-------------------------------------#
target_link_libraries(${TARGET_NAME} PUBLIC
#third-party libraries
${QT5_TARGETS}
${THIRD_PARTY_BLAH1_LIBRARIES}
${THIRD_PARTY_BLAH2_LIBRARIES}
#...
#module libraries
${LIB_MODULE_A}
${LIB_MODULE_B}
#...
)
if(UNIX)
#... link third-party dependencies conditional on platform
endif()
#---------------------------ADD TESTS------------------------------------------#
#SET(BUILD_TESTS FALSE)#comment out to build the local unit tests
root_add_tests(${module_name})
#==============================================================================#
The relevant script in RootUtils.cmake looks like this:
macro(augmentarium_add_subproject module_name proj_type qt_on)
if(${qt_on} STREQUAL "qt_on" OR ${qt_on} STREQUAL "YES" OR ${qt_on} STREQUAL "TRUE")
set(QT_ON TRUE)
else()
set(QT_ON FALSE)
endif()
#---------------------------DEFINE SUBPROJECT----------------------------------#
#TODO: fix problems with macro (figure out how to set up library as a subproject w/o destroying linking capability)
#project(${module_name}) # <------- THIS is the line that causes linker errors
set(TARGET_NAME ${module_name})
string(TOUPPER "${TARGET_NAME}" TARGET_NAME_UPPER)
if(QT_ON)
set(CMAKE_AUTOMOC ON)
endif()
#---------------------------DEFINE SOURCE FILES--------------------------------#
include_directories(include)
SET(${TARGET_NAME_UPPER}_TOP_INCLUDE_DIR include/${PROJECT_NAME}/${TARGET_NAME})
file(GLOB ${TARGET_NAME_UPPER}_CMAKELISTS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
file(GLOB ${TARGET_NAME_UPPER}_SOURCES src/*.cpp)
file(GLOB ${TARGET_NAME_UPPER}_HEADERS src/*.h src/*.h.in src/*.hpp src/*.tpp
${${TARGET_NAME_UPPER}_TOP_INCLUDE_DIR}/*.h
${${TARGET_NAME_UPPER}_TOP_INCLUDE_DIR}/*.h.in
${${TARGET_NAME_UPPER}_TOP_INCLUDE_DIR}/*.hpp
${${TARGET_NAME_UPPER}_TOP_INCLUDE_DIR}/*.tpp)
file(GLOB ${TARGET_NAME_UPPER}_TEST_SOURCES tests/*.cpp)
if(QT_ON)
file(GLOB_RECURSE MOC_${TARGET_NAME_UPPER}_SOURCES moc_*.cpp *_automoc.cpp qrc_*.cpp)
#remove generated moc files
foreach(FILE_NAME ${MOC_${TARGET_NAME_UPPER}_SOURCES})
list(REMOVE_ITEM ${TARGET_NAME_UPPER}_SOURCES ${FILE_NAME})
endforeach()
endif(QT_ON)
if(QT_ON)
#---------------------------ADD UI FILES---------------------------------------#
file(GLOB ${TARGET_NAME_UPPER}_UI src/*.ui)
if(BUILD_${TARGET_NAME})
#this macro doesn't get defined unless QtWidgets is found
qt5_wrap_ui(${TARGET_NAME_UPPER}_UI_HEADERS ${${TARGET_NAME_UPPER}_UI})
endif()
#---------------------------ADD RESOUCE FILES----------------------------------#
file(GLOB ${TARGET_NAME_UPPER}_RESOURCE_FILES *.qrc)
if(BUILD_${TARGET_NAME})
#this macro doesn't get defined unless QtWidgets is found
qt5_add_resources(${TARGET_NAME_UPPER}_GENERATED_RESOURCES ${${TARGET_NAME_UPPER}_RESOURCE_FILES})
endif()
endif(QT_ON)
#..........................organize source/header files........................#
source_group("Source Files" FILES ${${TARGET_NAME_UPPER}_SOURCES})
source_group("Header Files" FILES ${${TARGET_NAME_UPPER}_HEADERS})
if(QT_ON)
source_group("Resource Files" FILES ${${TARGET_NAME_UPPER}_RESOURCE_FILES})
source_group("UI Files" FILES ${${TARGET_NAME_UPPER}_UI})
source_group("Generated Files" FILES ${${TARGET_NAME_UPPER}_GENERATED_RESOURCES} ${${TARGET_NAME_UPPER}_UI_HEADERS})
endif()
#---------------------------ADD TARGET-----------------------------------------#
set(ALL_${TARGET_NAME_UPPER}_FILES
${${TARGET_NAME_UPPER}_CMAKELISTS}
${${TARGET_NAME_UPPER}_SOURCES}
${${TARGET_NAME_UPPER}_HEADERS}
${${TARGET_NAME_UPPER}_RESOURCE_FILES}
${${TARGET_NAME_UPPER}_UI}
${${TARGET_NAME_UPPER}_GENERATED_RESOURCES}
)
if(${proj_type} STREQUAL "executable")
add_executable(${TARGET_NAME} ${ALL_${TARGET_NAME_UPPER}_FILES})
elseif(${proj_type} STREQUAL "library")
add_library(${TARGET_NAME} STATIC ${ALL_${TARGET_NAME_UPPER}_FILES})
else()
add_custom_target(${TARGET_NAME} ${ALL_${TARGET_NAME_UPPER}_FILES})
endif()
endmacro()
If that's still not enough, here's how the subprojects are included in the module-level CMakeLists.txt:
foreach (MODULE_NAME ${MODULES})
add_subdirectory (${MODULE_NAME})
endforeach()
CMake version used: 3.1.3
How do you manage dependencies between libs with CMake? This should be done using TARGET_LINK_LIBRARIES(myexe mylib1 mylib2)