How to add x64 and RelWithDebInfo to a build target

已完成

I have a build target which is a test exe called test_injection_removal but I can only build it as Debug x86.

Before I created this target I have build chains for x86 & x64 and Release, Debug & RelWithDebInfo.

Why can I only see Debug x86? I need RelWithDebInfo x64.

0

I am currently using 

set(BUILD_ARCH "-m64")

in the CMakeLists.txt of the test_injection_removal target.

It seems to build a 64bit exe but I also have a 32bit dll dependency will that build as 32bit? Or should I use set(BUILD_ARCH "-m32") in that target's CMakeLists.txt ?

0

Hello!

In the drop-down list CLion shows only those profiles which are applicable for the selected run/debug configuration. Is there something in your CMakeLists.txt that makes only the "Debug | x86" profile available for the test_injection_removal target?

0

No the CMakeLists.txt is this:

enable_testing()

# set(BUILD_ARCH "-m64") - do I need this?

# Need to convert CMAKE style paths to native windows style paths
# otherwise paths will be invalid in a number of executables
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}" BUILD_DIR)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" TEST_BUILD_DIR)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" TEST_SOURCE_DIR)
# Eugh
string(REPLACE "\\" "\\\\" BUILD_DIR "${BUILD_DIR}")
string(REPLACE "\\" "\\\\" TEST_BUILD_DIR "${TEST_BUILD_DIR}")
string(REPLACE "\\" "\\\\" TEST_SOURCE_DIR "${TEST_SOURCE_DIR}")

configure_file(test_injection_removal.cpp test_injection_removal.cpp)

set(TEST_INJECTION_REMOVAL_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/test_injection_removal.cpp)

add_executable(test_injection_removal ${TEST_INJECTION_REMOVAL_SOURCES})

target_compile_options(test_injection_removal
PRIVATE
-nologo
-EHa
-GR
-W4
-WX
-wd4100)

target_include_directories(test_injection_removal
PRIVATE
$<TARGET_PROPERTY:test_injection_removal,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:harcoutilscpp,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:loader_lib,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:winutilscpp,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:common_io,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:common_util,INTERFACE_INCLUDE_DIRECTORIES>)

add_custom_command(TARGET test_injection_removal
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/dir with spaces"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/test_injection_removal.exe"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/dir with spaces/test_injection_removal.exe"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/loader/exe/${CMAKE_BUILD_TYPE}/loader.exe"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/dir with spaces/loader.exe"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/loader/exe/${CMAKE_BUILD_TYPE}/loader.exe"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/dir with spaces/x64/loader.exe"
MAIN_DEPENDENCY test_injection_removal
VERBATIM
)

set(LINK_OPTS -NOLOGO
-INCREMENTAL:NO)

target_link_libraries(test_injection_removal
PRIVATE
harcoutilscpp
loader_lib
winutilscpp
common_io
common_util
userenv
ws2_32)

add_dependencies(test_injection_removal blpmonitor
loader_exe)
0

If you select some other configuration in the drop-down, do other profiles appear there?

0

And what happens if you do Tools | CMake | Reset Cache and Reload Project ? Are all profiles loaded correctly? Or do you see errors in any tab?

0

Yes I definitely see the configurations on the other targets:

0

I performed the reset and reload but it made no difference!

0

Please send all the `cmake-build-***` folders to clion-support at jetbrains.com. We need them to investigate the situation. 

0

Hi,

Unfortunately the `cmake-build-***` folders are 2.2GB compressed!

Are there specific files that you want?

I could ftp the zip file to you?

0

We are interested in the ".cmake" subfolder of each `cmake-build-***` folder. BTW you can share files using https://uploads.services.jetbrains.com/ (you will need to share the Upload ID after the upload is completed successfully; you can send it to clion-support at jetbrains.com if you want).

0

Upload ID: 2022_06_09_afR4KpzEX9oLviBrVwrxKy

0

In `File | Settings | Build, Execution, Deployment | CMake` > `CMake options` please change -DCMAKE_BUILD_TYPE=*** to -DCMAKE_CONFIGURATION_TYPES=*** (for all CMake profiles) and then do `Tools | CMake | Reset Cache and Reload Project`. Does it help?

0

Sorry but changing the CMAKE_BUILD_TYPE to CMAKE_CONFIGURATION_TYPES did not make any difference.

0

According to the provided ".cmake" subfolders, the test_*** targets exist only for Debug | x86 and Debug | x64. We suspect that in your project the Release build type is somehow disabled for the test_*** targets. But we will need your project in order to investigate this. Without the project we won't be able to help you I'm afraid.

0

Hi Anna

Just let me know what files you want and I will send them.

Thanks Dave

0

It's hard to choose the specific files. I think we need the entire project (without the `cmake-build-***` folders).

0

Anna

Just to claify, you want all of our cpp and h files?

Including dependent repos?

Thanks Dave

0

There are two ways:

Someone from your team can investigate why the Release build type is disabled for the test_*** targets in the project.

Or, if you want us to take a look, then we need at least to take a look at the project structure, logics, settings etc. So please send us all the CMakeLists.txt and *.cmake files, keeping the folder nesting so that the project structure is preserved.

0

Anna

 

I can certainly send you the CMakeLists.txt and *.cmake files in a zip.

I will work on that now.

 

Thanks Dave

0

Anna

Upload ID: 2022_06_22_dqfzbHbaYz78oNB9WQtBVM (file: Agent.zip)

Thanks Dave

0

First of all: in bloomberg/CMakeLists.txt you have

if(NOT "${ARCH_PREFIX}" STREQUAL "x64/")
    add_subdirectory(bloomberg-monitor)
else()

It means the entire bloomberg-monitor subdirectory (including the tests you're interested in) is added only in case of x86.

Secondly, the tests are included only if WITH_TEST is enabled, while by default it's disabled

option(WITH_TEST "Build test applications" OFF)

There might be other conditions regarding Release/Debug, for example. Please inspect your project more thoroughly.

0

Anna

The WITH_TEST is all by design as we do not want production releases to include unit test executables.

The x86 bloomberg-monitor is again by design as we do not want/need a x64 version for those builds under bloomberg-monitor.

 

Grepping for release and relwithdebinfo in the CMakeLists.txt I can see none that are not valid:

 

d.streeter@DSTREETER-BFD MINGW64 ~/source/repos/gma-agent-2010 (DART-2777_2)
$ find . -type f -name CMakeLists.txt -print0 | xargs -0 grep -i -e release -e relwithdebinfo | grep -v -e Boost_THREAD_LIBRARY_RELEASE -e Boost_THREAD_LIBRARY_DEBUG -e cmake-build-relwithdebinfo -e cmake-build-release -e RELEASE_VERSION -e 'for release' -e 'agent release' -e 'release-1' -e build_RelWithDebInfo -e build_Release -e 'Debug Release RelWithDebInfo' -e DRELEASE_ID -e Boost_SYSTEM_LIBRARY_RELEASE -e Boost_SYSTEM_LIBRARY_DEBUG -e 'RELEASE-NOTES' -e ' Agent release' -e 'the release folder' -e ' past releases' -e 'RELEASE-NOTES' -e 'compile in release' -e 'production releases' -e 'build-and-release' -e 'release_id' -e '/build/release'

d.streeter@DSTREETER-BFD MINGW64 ~/source/repos/gma-agent-2010 (DART-2777_2)
$

 

Thanks Dave

0

Originally you asked:

Why can I only see Debug x86? I need RelWithDebInfo x64.

Now you say that "the x86 bloomberg-monitor is again by design". Then why did you expect a x64 profile to be available for the test_injection_removal configuration which is a part of bloomberg-monitor and therefore is x86 by design?

The project is really huge, it has lots of conditions and switches. We can't thoroughly inspect the entire project for you, it's simply out of scope of CLion support.

0

请先登录再写评论。