Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake error on Windows when disabling tests #183

Closed
helgemathee opened this issue Mar 23, 2017 · 1 comment
Closed

CMake error on Windows when disabling tests #183

helgemathee opened this issue Mar 23, 2017 · 1 comment

Comments

@helgemathee
Copy link

helgemathee commented Mar 23, 2017

Description of Issue

Certain properties can't be set in cmake if tests are disable. Fixed it using attached patch file.

Applies to base/lib/plug.CMakeLists.txt

--- CMakeLists.txt  Wed Mar 22 09:19:25 2017
+++ /c/temp/CMakeLists.txt  Thu Mar 23 11:38:14 2017
@@ -98,16 +98,18 @@
 # but some linkers by default will error out when building this due
 # to the references to undefined symbols. So we need to specify a
 # link flag to force these symbols to be looked up at runtime.
-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-    set_target_properties(TestPlugDsoUnloadable
-        PROPERTIES
-        LINK_FLAGS "-undefined dynamic_lookup"
-    )
-elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
-    set_target_properties(TestPlugDsoUnloadable
-        PROPERTIES
-        LINK_FLAGS "/FORCE:UNRESOLVED"
-    )
+if (${PXR_BUILD_TESTS})
+    if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+        set_target_properties(TestPlugDsoUnloadable
+            PROPERTIES
+            LINK_FLAGS "-undefined dynamic_lookup"
+        )
+    elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
+        set_target_properties(TestPlugDsoUnloadable
+            PROPERTIES
+            LINK_FLAGS "/FORCE:UNRESOLVED"
+        )
+    endif()
 endif()
 
 pxr_create_test_module(TestPlugModule1

Steps to Reproduce

Build USD on windows without tests.

System Information (OS, Hardware)

Package Versions

Build Flags

@jtran56
Copy link

jtran56 commented Mar 23, 2017

Filed as internal issue #144464.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants