EDIT: I found a probable reason, but I donโt understand why: the last line below the script Project(Externals) when deleting fixes my problem. So now the question is: why?
cmake_minimum_required(VERSION 2.8) include(ExternalProject) MACRO(EXTERNAL_DEF aNewTargetName aPathToSource) ExternalProject_Add( ${aNewTargetName} PREFIX ${CMAKE_INSTALL_PREFIX} SOURCE_DIR ${aPathToSource} TMP_DIR "${CMAKE_INSTALL_PREFIX}/tmp/${CMAKE_BUILD_TYPE}" DOWNLOAD_DIR "${CMAKE_INSTALL_PREFIX}/src/${CMAKE_BUILD_TYPE}" BINARY_DIR "${CMAKE_INSTALL_PREFIX}/src/${CMAKE_BUILD_TYPE}/${aNewTargetName}-build" STAMP_DIR "${CMAKE_INSTALL_PREFIX}/src/${CMAKE_BUILD_TYPE}/${aNewTargetName}-stamp" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} --debug-output BUILD_COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_INSTALL_PREFIX}/src/${CMAKE_BUILD_TYPE}/${aNewTargetName}-build" --config "${CMAKE_BUILD_TYPE}"
I call cmake in the above CMakeLists.txt file with CMAKE_INSTALL_PREFIX to say "d: \ externals" and CMAKE_BUILD_TYPE set "Release"
Expectation: I would expect only the Release configuration to be built. And after it is built, I expect it to be installed in D:\externals\bin\zlib.dll .
Problem: Actually, ExternalProject_Add creates both Debug and Release and installs the debug version of the dll in D:\externals\bin\zlibd.dll
Is my build script correct? What am I doing wrong?
EDIT: some more info. I just noticed. In the generated D: \ externals \ src \ Release \ zlib_external-build \ zlib.sln, the INSTALL target is not selected for assembly at all. If I check it for creating the Release configuration, click Build from visual studio, the INSTALL target builds and installs the files I expect them to be. I have no idea what's going on ...
source share